package com.nokia.sms.sgip.codec;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderAdapter;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;

import com.nokia.sms.sgip.message.SgipMessage;

public class SgipMessageEncoder extends ProtocolEncoderAdapter {
    public void encode(IoSession session, Object object, ProtocolEncoderOutput out)
            throws Exception {
        SgipMessage message = (SgipMessage) object;
        IoBuffer buffer = message.getBuffer();
        out.write(buffer);
        out.flush();
    }
}
