public final class BinaryHttpParser
extends java.lang.Object
| Constructor and Description |
|---|
BinaryHttpParser(int maxFieldSectionSize)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
io.netty.handler.codec.http.HttpObject |
parse(io.netty.buffer.ByteBuf in,
boolean completeBodyReceived)
Parse the given
ByteBuf and converts it to HttpObjects. |
public BinaryHttpParser(int maxFieldSectionSize)
maxFieldSectionSize - the maximum size of the field-section (in bytes)public io.netty.handler.codec.http.HttpObject parse(io.netty.buffer.ByteBuf in,
boolean completeBodyReceived)
ByteBuf and converts it to HttpObjects.
This method should be called in a loop until it returns null.
for (;;) {
HttpObject msg = parser.parse(in, completeBodyReceived);
if (msg == null) {
// Try again later once there are more readable bytes in the input buffer.
return;
}
// Do something with the msg.
}
The returned HttpObject will form a valid sequence like:
1It might also use the shortcut ofHttpMessage, 0-nHttpContent, 1LastHttpContent.
FullHttpMessage to represent a full sequence.in - the ByteBuf to parse.completeBodyReceived - true if we should consider the end of body to be received, false
otherwise.HttpObject or null if this method should be called again later once there are
more readable bytes in the input ByteBuf.Copyright © 2023 The Netty Project. All Rights Reserved.