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
AProtocolEncoderOutput
based 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 WriteFuture
doFlush(ByteBuffer buf)
WriteFuture
flush()
Flushes all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)
to the session.java.util.Queue<ByteBuffer>
getBufferQueue()
void
mergeAll()
Merges all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)
into oneByteBuffer
and replaces the old fragmented ones with it.void
write(ByteBuffer buf)
Callback forProtocolEncoder
to generate encodedByteBuffer
s.
-
-
-
Method Detail
-
getBufferQueue
public java.util.Queue<ByteBuffer> getBufferQueue()
-
write
public void write(ByteBuffer buf)
Description copied from interface:ProtocolEncoderOutput
Callback forProtocolEncoder
to generate encodedByteBuffer
s.ProtocolEncoder
must callProtocolEncoderOutput.write(ByteBuffer)
for each encoded message.- Specified by:
write
in interfaceProtocolEncoderOutput
- Parameters:
buf
- the buffer which contains encoded data
-
mergeAll
public void mergeAll()
Description copied from interface:ProtocolEncoderOutput
Merges all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)
into oneByteBuffer
and replaces the old fragmented ones with it. This method is useful when you want to control the way MINA generates network packets.- Specified by:
mergeAll
in interfaceProtocolEncoderOutput
-
flush
public WriteFuture flush()
Description copied from interface:ProtocolEncoderOutput
Flushes all buffers you wrote viaProtocolEncoderOutput.write(ByteBuffer)
to the session. This operation is asynchronous; please wait for the returnedWriteFuture
if you want to wait for the buffers flushed.- Specified by:
flush
in interfaceProtocolEncoderOutput
- Returns:
- null if there is nothing to flush at all.
-
doFlush
protected abstract WriteFuture doFlush(ByteBuffer buf)
-
-