org.apache.mina.filter.codec
Interface ProtocolEncoderOutput

All Known Implementing Classes:
AbstractProtocolEncoderOutput

public interface ProtocolEncoderOutput

Callback for ProtocolEncoder to generate encoded messages such as IoBuffers. ProtocolEncoder must call write(Object) for each encoded message.

Author:
Apache MINA Project

Method Summary
 WriteFuture flush()
          Flushes all buffers you wrote via write(Object) to the session.
 void mergeAll()
          Merges all buffers you wrote via write(Object) into one IoBuffer and replaces the old fragmented ones with it.
 void write(Object encodedMessage)
          Callback for ProtocolEncoder to generate an encoded message such as an IoBuffer.
 

Method Detail

write

void write(Object encodedMessage)
Callback for ProtocolEncoder to generate an encoded message such as an IoBuffer. ProtocolEncoder must call write(Object) for each encoded message.

Parameters:
encodedMessage - the encoded message, typically an IoBuffer or a FileRegion.

mergeAll

void mergeAll()
Merges all buffers you wrote via write(Object) into one IoBuffer and 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 called write(Object) method with only IoBuffers.

Throws:
IllegalStateException - if you wrote something else than IoBuffer

flush

WriteFuture flush()
Flushes all buffers you wrote via write(Object) 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.


Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.