Search in sources :

Example 1 with ProtocolEncoderOutput

use of org.apache.mina.filter.codec.ProtocolEncoderOutput in project camel by apache.

the class Mina2UdpProtocolCodecFactory method getEncoder.

public ProtocolEncoder getEncoder(IoSession session) throws Exception {
    return new ProtocolEncoder() {

        public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
            IoBuffer buf = toIoBuffer(message);
            buf.flip();
            out.write(buf);
        }

        public void dispose(IoSession session) throws Exception {
        // do nothing
        }
    };
}
Also used : ProtocolEncoder(org.apache.mina.filter.codec.ProtocolEncoder) IoSession(org.apache.mina.core.session.IoSession) ProtocolEncoderOutput(org.apache.mina.filter.codec.ProtocolEncoderOutput) IoBuffer(org.apache.mina.core.buffer.IoBuffer)

Example 2 with ProtocolEncoderOutput

use of org.apache.mina.filter.codec.ProtocolEncoderOutput in project camel by apache.

the class MinaUdpProtocolCodecFactory method getEncoder.

public ProtocolEncoder getEncoder() throws Exception {
    return new ProtocolEncoder() {

        public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception {
            ByteBuffer buf = toByteBuffer(message);
            buf.flip();
            out.write(buf);
        }

        public void dispose(IoSession session) throws Exception {
        // do nothing
        }
    };
}
Also used : ProtocolEncoder(org.apache.mina.filter.codec.ProtocolEncoder) ByteBuffer(org.apache.mina.common.ByteBuffer) IoSession(org.apache.mina.common.IoSession) ProtocolEncoderOutput(org.apache.mina.filter.codec.ProtocolEncoderOutput)

Aggregations

ProtocolEncoder (org.apache.mina.filter.codec.ProtocolEncoder)2 ProtocolEncoderOutput (org.apache.mina.filter.codec.ProtocolEncoderOutput)2 ByteBuffer (org.apache.mina.common.ByteBuffer)1 IoSession (org.apache.mina.common.IoSession)1 IoBuffer (org.apache.mina.core.buffer.IoBuffer)1 IoSession (org.apache.mina.core.session.IoSession)1