Interface ProtocolEncoderOutput
- All Known Implementing Classes:
AbstractProtocolEncoderOutput, ProtocolCodecFilter.ProtocolEncoderOutputImpl
public interface ProtocolEncoderOutput
Callback for
ProtocolEncoder to generate encoded messages such as
IoBuffers. ProtocolEncoder must call write(Object)
for each encoded message.-
Method Summary
Modifier and TypeMethodDescriptionflush()Flushes all buffers you wrote viawrite(Object)to the session.voidmergeAll()Merges all buffers you wrote viawrite(Object)into oneIoBufferand replaces the old fragmented ones with it.voidCallback forProtocolEncoderto generate an encoded message such as anIoBuffer.
-
Method Details
-
write
Callback forProtocolEncoderto generate an encoded message such as anIoBuffer.ProtocolEncodermust callwrite(Object)for each encoded message.- Parameters:
encodedMessage- the encoded message, typically anIoBufferor aFileRegion.
-
mergeAll
void mergeAll()Merges all buffers you wrote viawrite(Object)into oneIoBufferand replaces the old fragmented ones with it. This method is useful when you want to control the way MINA generates network packets. Please note that this method only works when you calledwrite(Object)method with onlyIoBuffers.- Throws:
IllegalStateException- if you wrote something else thanIoBuffer
-
flush
WriteFuture flush()Flushes all buffers you wrote viawrite(Object)to the session. This operation is asynchronous; please wait for the returnedWriteFutureif you want to wait for the buffers flushed.- Returns:
nullif there is nothing to flush at all.
-