public class Parser
extends java.lang.Object
The HTTP/2 protocol parser.
This parser makes use of the HeaderParser
and of
BodyParser
s to parse HTTP/2 frames.
Modifier and Type | Class and Description |
---|---|
static interface |
Parser.Listener |
Constructor and Description |
---|
Parser(ByteBufferPool byteBufferPool,
Parser.Listener listener,
int maxDynamicTableSize,
int maxHeaderSize) |
Modifier and Type | Method and Description |
---|---|
protected int |
getFrameType() |
int |
getMaxFrameLength() |
int |
getMaxSettingsKeys() |
protected boolean |
hasFlag(int bit) |
void |
init(java.util.function.UnaryOperator<Parser.Listener> wrapper) |
protected void |
notifyConnectionFailure(int error,
java.lang.String reason) |
void |
parse(java.nio.ByteBuffer buffer)
Parses the given
buffer bytes and emit events to a Parser.Listener . |
protected boolean |
parseBody(java.nio.ByteBuffer buffer) |
protected boolean |
parseHeader(java.nio.ByteBuffer buffer) |
void |
setMaxFrameLength(int maxFrameLength) |
void |
setMaxSettingsKeys(int maxSettingsKeys) |
public Parser(ByteBufferPool byteBufferPool, Parser.Listener listener, int maxDynamicTableSize, int maxHeaderSize)
public void init(java.util.function.UnaryOperator<Parser.Listener> wrapper)
public void parse(java.nio.ByteBuffer buffer)
Parses the given buffer
bytes and emit events to a Parser.Listener
.
When this method returns, the buffer may not be fully consumed, so invocations to this method should be wrapped in a loop:
while (buffer.hasRemaining()) parser.parse(buffer);
buffer
- the buffer to parseprotected boolean parseHeader(java.nio.ByteBuffer buffer)
protected boolean parseBody(java.nio.ByteBuffer buffer)
protected int getFrameType()
protected boolean hasFlag(int bit)
public int getMaxFrameLength()
public void setMaxFrameLength(int maxFrameLength)
public int getMaxSettingsKeys()
public void setMaxSettingsKeys(int maxSettingsKeys)
protected void notifyConnectionFailure(int error, java.lang.String reason)
Copyright © 1995–2023 Webtide. All rights reserved.