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>
-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptOutboundMessage(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 MessageToByteEncoder
allocateBuffer, isPreferDirect, writeMethods inherited from class ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved
-
Constructor Details
-
Encoder
Encoder(boolean preferDirect) -
Encoder
Encoder(boolean preferDirect, java.lang.Class<? extends I> outboundMessageType)
-
-
Method Details
-
acceptOutboundMessage
public boolean acceptOutboundMessage(java.lang.Object msg) throws java.lang.Exception Description 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
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
-