private final class ByteToMessageCodec.Encoder extends MessageToByteEncoder<I>
ChannelHandler.Sharable
Constructor and Description |
---|
Encoder(boolean preferDirect) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptOutboundMessage(java.lang.Object msg)
Returns
true if the given message should be handled. |
protected void |
encode(ChannelHandlerContext ctx,
I msg,
ByteBuf out)
Encode a message into a
ByteBuf . |
allocateBuffer, write
bind, close, connect, deregister, disconnect, flush, read
exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public boolean acceptOutboundMessage(java.lang.Object msg) throws java.lang.Exception
MessageToByteEncoder
true
if the given message should be handled. If false
it will be passed to the next
ChannelOutboundHandler
in the ChannelPipeline
.acceptOutboundMessage
in class MessageToByteEncoder<I>
java.lang.Exception
protected void encode(ChannelHandlerContext ctx, I msg, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<I>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs tomsg
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenjava.lang.Exception
- is thrown if an error accour