org.apache.mina.filter.codec

Interface ProtocolEncoderOutput

Known Implementing Classes:
SimpleProtocolEncoderOutput

public interface ProtocolEncoderOutput

Callback for ProtocolEncoder to generate encoded ByteBuffers. ProtocolEncoder must call write(ByteBuffer) for each encoded message.

Method Summary

WriteFuture
flush()
Flushes all buffers you wrote via write(ByteBuffer) to the session.
void
mergeAll()
Merges all buffers you wrote via write(ByteBuffer) into one ByteBuffer and replaces the old fragmented ones with it.
void
write(ByteBuffer buf)
Callback for ProtocolEncoder to generate encoded ByteBuffers.

Method Details

flush

public WriteFuture flush()
Flushes all buffers you wrote via write(ByteBuffer) to the session. This operation is asynchronous; please wait for the returned WriteFuture if you want to wait for the buffers flushed.
Returns:
null if there is nothing to flush at all.

mergeAll

public void mergeAll()
Merges all buffers you wrote via write(ByteBuffer) into one ByteBuffer and replaces the old fragmented ones with it. This method is useful when you want to control the way MINA generates network packets.

write

public void write(ByteBuffer buf)
Callback for ProtocolEncoder to generate encoded ByteBuffers. ProtocolEncoder must call write(ByteBuffer) for each encoded message.
Parameters:
buf - the buffer which contains encoded data