public class Parser extends 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() |
protected boolean |
hasFlag(int bit) |
protected void |
notifyConnectionFailure(int error,
String reason) |
void |
parse(ByteBuffer buffer)
Parses the given
buffer bytes and emit events to a Parser.Listener . |
protected boolean |
parseBody(ByteBuffer buffer) |
protected boolean |
parseHeader(ByteBuffer buffer) |
public Parser(ByteBufferPool byteBufferPool, Parser.Listener listener, int maxDynamicTableSize, int maxHeaderSize)
public void parse(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(ByteBuffer buffer)
protected boolean parseBody(ByteBuffer buffer)
protected int getFrameType()
protected boolean hasFlag(int bit)
protected void notifyConnectionFailure(int error, String reason)
Copyright © 1995–2017 Webtide. All rights reserved.