Top Description Fields Constructors Methods
io.netty.contrib.handler.codec.haproxy

public final Class HAProxyMessageEncoder

extends MessageToByteEncoder<HAProxyMessage>
Class Inheritance
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.MessageToByteEncoder, java.nio.charset.StandardCharsets, io.netty5.util.NetUtil, java.util.List

Encodes an HAProxy proxy protocol message
See Also
Proxy Protocol Specification

Field Summary

Modifier and TypeField and Description
public static final HAProxyMessageEncoder
pack-priv static final int
pack-priv static final int
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected Buffer
allocateBuffer(ChannelHandlerContext ctx, HAProxyMessage
the message to be encoded
msg
)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Allocate a Buffer which will be used as argument of encode(ChannelHandlerContext, I, Buffer).
protected void
encode(ChannelHandlerContext ctx, HAProxyMessage
the message to encode
msg
,
Buffer
the Buffer into which the encoded message will be written
out
)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.encode.

Encode a message into a Buffer.
private static void
encodeTlv(HAProxyTLV haProxyTLV, Buffer out)

private static void
encodeTlvs(List<HAProxyTLV> haProxyTLVs, Buffer out)

private static void
private static void
public boolean
isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline.
Inherited from io.netty5.handler.codec.MessageToByteEncoder:
acceptOutboundMessagewrite

Field Detail

INSTANCEback to summary
public static final HAProxyMessageEncoder INSTANCE
TOTAL_UNIX_ADDRESS_BYTES_LENGTHback to summary
pack-priv static final int TOTAL_UNIX_ADDRESS_BYTES_LENGTH
UNIX_ADDRESS_BYTES_LENGTHback to summary
pack-priv static final int UNIX_ADDRESS_BYTES_LENGTH
V2_VERSION_BITMASKback to summary
private static final int V2_VERSION_BITMASK

Constructor Detail

HAProxyMessageEncoderback to summary
private HAProxyMessageEncoder()

Method Detail

allocateBufferback to summary
protected Buffer allocateBuffer(ChannelHandlerContext ctx, HAProxyMessage msg)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Doc from io.netty5.handler.codec.MessageToByteEncoder.allocateBuffer.

Allocate a Buffer which will be used as argument of encode(ChannelHandlerContext, I, Buffer).

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToByteEncoder belongs to

msg:HAProxyMessage

the message to be encoded

Annotations
@Override
encodeback to summary
protected void encode(ChannelHandlerContext ctx, HAProxyMessage msg, Buffer out)

Implements abstract io.netty5.handler.codec.MessageToByteEncoder.encode.

Doc from io.netty5.handler.codec.MessageToByteEncoder.encode.

Encode a message into a Buffer. This method will be called for each written message that can be handled by this encoder.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToByteEncoder belongs to

msg:HAProxyMessage

the message to encode

out:Buffer

the Buffer into which the encoded message will be written

Annotations
@Override
encodeTlvback to summary
private static void encodeTlv(HAProxyTLV haProxyTLV, Buffer out)
encodeTlvsback to summary
private static void encodeTlvs(List<HAProxyTLV> haProxyTLVs, Buffer out)
encodeV1back to summary
private static void encodeV1(HAProxyMessage msg, Buffer out)
encodeV2back to summary
private static void encodeV2(HAProxyMessage msg, Buffer out)
isSharableback to summary
public boolean isSharable()

Overrides default io.netty5.channel.ChannelHandler.isSharable.

Doc from io.netty5.channel.ChannelHandler.isSharable.

Returns true if this handler is sharable and thus can be added to more than one ChannelPipeline. By default, this method returns false. If this method returns false, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.

Annotations
@Override