Class SimpleProtocolEncoderOutput
- java.lang.Object
-
- org.apache.mina.filter.codec.support.SimpleProtocolEncoderOutput
-
- All Implemented Interfaces:
ProtocolEncoderOutput
public abstract class SimpleProtocolEncoderOutput extends java.lang.Object implements ProtocolEncoderOutput
AProtocolEncoderOutputbased on queue.
-
-
Constructor Summary
Constructors Constructor Description SimpleProtocolEncoderOutput()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract WriteFuturedoFlush(ByteBuffer buf)WriteFutureflush()Flushes all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)to the session.java.util.Queue<ByteBuffer>getBufferQueue()voidmergeAll()Merges all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)into oneByteBufferand replaces the old fragmented ones with it.voidwrite(ByteBuffer buf)Callback forProtocolEncoderto generate encodedByteBuffers.
-
-
-
Method Detail
-
getBufferQueue
public java.util.Queue<ByteBuffer> getBufferQueue()
-
write
public void write(ByteBuffer buf)
Description copied from interface:ProtocolEncoderOutputCallback forProtocolEncoderto generate encodedByteBuffers.ProtocolEncodermust callProtocolEncoderOutput.write(ByteBuffer)for each encoded message.- Specified by:
writein interfaceProtocolEncoderOutput- Parameters:
buf- the buffer which contains encoded data
-
mergeAll
public void mergeAll()
Description copied from interface:ProtocolEncoderOutputMerges all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)into oneByteBufferand replaces the old fragmented ones with it. This method is useful when you want to control the way MINA generates network packets.- Specified by:
mergeAllin interfaceProtocolEncoderOutput
-
flush
public WriteFuture flush()
Description copied from interface:ProtocolEncoderOutputFlushes all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)to the session. This operation is asynchronous; please wait for the returnedWriteFutureif you want to wait for the buffers flushed.- Specified by:
flushin interfaceProtocolEncoderOutput- Returns:
- null if there is nothing to flush at all.
-
doFlush
protected abstract WriteFuture doFlush(ByteBuffer buf)
-
-