Package io.netty.handler.codec.haproxy
Class HAProxyMessageDecoder.HeaderExtractor
- java.lang.Object
-
- io.netty.handler.codec.haproxy.HAProxyMessageDecoder.HeaderExtractor
-
- Direct Known Subclasses:
HAProxyMessageDecoder.LineHeaderExtractor,HAProxyMessageDecoder.StructHeaderExtractor
- Enclosing class:
- HAProxyMessageDecoder
private abstract class HAProxyMessageDecoder.HeaderExtractor extends java.lang.ObjectHeaderExtractor create a header frame out of theByteBuf.
-
-
Field Summary
Fields Modifier and Type Field Description private intmaxHeaderSizeHeader max size
-
Constructor Summary
Constructors Modifier Constructor Description protectedHeaderExtractor(int maxHeaderSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract intdelimiterLength(ByteBuf buffer, int eoh)Get the length of the header delimiter.ByteBufextract(ChannelHandlerContext ctx, ByteBuf buffer)Create a frame out of theByteBufand return it.protected abstract intfindEndOfHeader(ByteBuf buffer)Find the end of the header from the givenByteBuf,the end may be a CRLF, or the length given by the header.
-
-
-
Method Detail
-
extract
public ByteBuf extract(ChannelHandlerContext ctx, ByteBuf buffer) throws java.lang.Exception
Create a frame out of theByteBufand return it.- Parameters:
ctx- theChannelHandlerContextwhich thisHAProxyMessageDecoderbelongs tobuffer- theByteBuffrom which to read data- Returns:
- frame the
ByteBufwhich represent the frame ornullif no frame could be created - Throws:
java.lang.Exception- if exceed maxLength
-
findEndOfHeader
protected abstract int findEndOfHeader(ByteBuf buffer)
Find the end of the header from the givenByteBuf,the end may be a CRLF, or the length given by the header.- Parameters:
buffer- the buffer to be searched- Returns:
-1if can not find the end, otherwise return the buffer index of end
-
delimiterLength
protected abstract int delimiterLength(ByteBuf buffer, int eoh)
Get the length of the header delimiter.- Parameters:
buffer- the buffer where delimiter is locatedeoh- index of delimiter- Returns:
- length of the delimiter
-
-