Package io.netty.handler.codec
Class ByteToMessageCodec.Encoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- io.netty.handler.codec.MessageToByteEncoder<I>
-
- io.netty.handler.codec.ByteToMessageCodec.Encoder
-
- All Implemented Interfaces:
ChannelHandler,ChannelOutboundHandler
- Enclosing class:
- ByteToMessageCodec<I>
private final class ByteToMessageCodec.Encoder extends MessageToByteEncoder<I>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor Description Encoder(boolean preferDirect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptOutboundMessage(java.lang.Object msg)Returnstrueif the given message should be handled.protected voidencode(ChannelHandlerContext ctx, I msg, ByteBuf out)Encode a message into aByteBuf.-
Methods inherited from class io.netty.handler.codec.MessageToByteEncoder
allocateBuffer, isPreferDirect, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Method Detail
-
acceptOutboundMessage
public boolean acceptOutboundMessage(java.lang.Object msg) throws java.lang.ExceptionDescription copied from class:MessageToByteEncoderReturnstrueif the given message should be handled. Iffalseit will be passed to the nextChannelOutboundHandlerin theChannelPipeline.- Overrides:
acceptOutboundMessagein classMessageToByteEncoder<I>- Throws:
java.lang.Exception
-
encode
protected void encode(ChannelHandlerContext ctx, I msg, ByteBuf out) throws java.lang.Exception
Description copied from class:MessageToByteEncoderEncode a message into aByteBuf. This method will be called for each written message that can be handled by this encoder.- Specified by:
encodein classMessageToByteEncoder<I>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToByteEncoderbelongs tomsg- the message to encodeout- theByteBufinto which the encoded message will be written- Throws:
java.lang.Exception- is thrown if an error occurs
-
-