public class NumberEncoder extends MessageToByteEncoder<Number>
Number
into the binary representation prepended with
a magic number ('F' or 0x46) and a 32-bit length prefix. For example, 42
will be encoded to { 'F', 0, 0, 0, 1, 42 }.ChannelHandler.Sharable
Constructor and Description |
---|
NumberEncoder() |
Modifier and Type | Method and Description |
---|---|
protected void |
encode(ChannelHandlerContext ctx,
Number msg,
ByteBuf out)
Encode a message into a
ByteBuf . |
acceptOutboundMessage, allocateBuffer, isPreferDirect, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
protected void encode(ChannelHandlerContext ctx, Number msg, ByteBuf out)
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
in class MessageToByteEncoder<Number>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs tomsg
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenCopyright © 2008–2020 The Netty Project. All rights reserved.