Typical lifecycle looks like this:
new Decoder
(configure(ConnectionSettings) called once from our HTTP/3 settings
decodeHeader
Decoder does not require a complete header block in a single
ByteBuffer. The header block can be spread across many buffers of any
size and decoded one-by-one the way it makes most sense for the user. This
way also allows not to limit the size of the header block.
Headers are delivered to the callback as soon as they become decoded. Using the callback also gives the user freedom to decide how headers are processed. The callback does not limit the number of headers decoded during single decoding operation.
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final ReentrantLock | |
| private long | |
| private final AtomicLong | |
| private final AtomicLong | |
| private static final AtomicLong | |
| private final QueuingStreamPair | |
| private final DynamicTable | |
| private final EncoderInstructionsReader | |
| private final QPACK. | |
| private static final long | |
| private volatile long | |
| private volatile long | |
| private final QPACK. |
| Access | Constructor and Description |
|---|---|
| public | Decoder(QPACK.
Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public void | ackSection(long
stream ID associated with the field section's streamId, HeaderFrameReader header frame reader used to read
the field line section headerFrameReader)Submit "Section Acknowledgment" instruction to the decoder stream. |
| public void | |
| public void | |
| public void | configure(ConnectionSettings
connection settings ourSettings)Configures maximum capacity of the decoder's dynamic table based on connection settings of the HTTP client, also configures the number of allowed blocked streams. |
| public void | decodeHeader(ByteBuffer
the chunk of the header block, may be empty headerBlock, boolean true if the chunk is the final (or the only one) in the sequence endOfHeaderBlock, HeaderFrameReader the stateful header frame reader headerFrameReader)Decodes a header block from the given buffer to the given callback. |
| public QueuingStreamPair | |
| pack-priv void | |
| public HeaderFrameReader | Returns: a newHeaderFrameReader that will hold the decoding
state for a new request/response streamReturns a new |
| private void | processEncoderInstruction(ByteBuffer buffer)
This method is invoked when the decoder's stream reader has data available for reading. |
| public void | |
| private void |
| ackInsertCountLock | back to summary |
|---|---|
| private final ReentrantLock ackInsertCountLock | |
| acknowledgedInsertsCount | back to summary |
|---|---|
| private long acknowledgedInsertsCount | |
| blockedStreamsCounter | back to summary |
|---|---|
| private final AtomicLong blockedStreamsCounter | |
| concurrentDynamicTableInsertions | back to summary |
|---|---|
| private final AtomicLong concurrentDynamicTableInsertions | |
| DECODERS_IDS | back to summary |
|---|---|
| private static final AtomicLong DECODERS_IDS | |
| decoderStreamPair | back to summary |
|---|---|
| private final QueuingStreamPair decoderStreamPair | |
| dynamicTable | back to summary |
|---|---|
| private final DynamicTable dynamicTable | |
| encoderInstructionsReader | back to summary |
|---|---|
| private final EncoderInstructionsReader encoderInstructionsReader | |
| logger | back to summary |
|---|---|
| private final QPACK. | |
| MAX_LITERAL_WITH_INDEXING | back to summary |
|---|---|
| private static final long MAX_LITERAL_WITH_INDEXING | |
| maxBlockedStreams | back to summary |
|---|---|
| private volatile long maxBlockedStreams | |
| maxFieldSectionSize | back to summary |
|---|---|
| private volatile long maxFieldSectionSize | |
| qpackErrorHandler | back to summary |
|---|---|
| private final QPACK. | |
| Decoder | back to summary |
|---|---|
| public Decoder(QPACK. Constructs a Dynamic table capacity values has to be agreed between decoder and encoder out-of-band, e.g. by a protocol that uses QPACK. Maximum dynamic table capacity is determined by the value of SETTINGS_QPACK_MAX_TABLE_CAPACITY HTTP/3 setting sent by the decoder side (see 3.2.3. Maximum Dynamic Table Capacity). An encoder informs the decoder of a change to the dynamic table capacity using the "Set Dynamic Table Capacity" instruction (see 4.3.1. Set Dynamic Table Capacity) | |
| ackSection | back to summary |
|---|---|
| public void ackSection(long streamId, HeaderFrameReader headerFrameReader) Submit "Section Acknowledgment" instruction to the decoder stream. A field line section needs to be acknowledged after completion of section decoding.
| |
| ackTableInsertions | back to summary |
|---|---|
| public void ackTableInsertions() | |
| cancelStream | back to summary |
|---|---|
| public void cancelStream(long streamId) | |
| configure | back to summary |
|---|---|
| public void configure(ConnectionSettings ourSettings) Configures maximum capacity of the decoder's dynamic table based on connection settings of the HTTP client, also configures the number of allowed blocked streams. The decoder's dynamic table capacity can only be changed via encoder instructions callback.
| |
| decodeHeader | back to summary |
|---|---|
| public void decodeHeader(ByteBuffer headerBlock, boolean endOfHeaderBlock, HeaderFrameReader headerFrameReader) Decodes a header block from the given buffer to the given callback. Suppose a header block is represented by a sequence of
HeaderFrameReader headerFrameReader =
newHeaderFrameReader(decodingCallback);
while (buffers.hasNext()) {
ByteBuffer input = buffers.next();
decoder.decodeHeader(input, !buffers.hasNext(), headerFrameReader);
}
The decoder reads as much as possible of the header block from the given buffer, starting at the buffer's position, and increments its position to reflect the bytes read. The buffer's mark and limit will not be modified. Once the method is invoked with Each callback method is called only after the implementation has
processed the corresponding bytes. If the bytes revealed a decoding
error it is reported via a callback registered within the API Note The method asks for Implementation Note This implementation is not atomic in respect to decoding errors. In other words, if the decoding operation has thrown a decoding error, the decoder is no longer usable.
| |
| decoderStreams | back to summary |
|---|---|
| public QueuingStreamPair decoderStreams() | |
| incrementAndCheckDynamicTableInsertsCount | back to summary |
|---|---|
| pack-priv void incrementAndCheckDynamicTableInsertsCount() | |
| newHeaderFrameReader | back to summary |
|---|---|
| public HeaderFrameReader newHeaderFrameReader(DecodingCallback decodingCallback) Returns a new
| |
| processEncoderInstruction | back to summary |
|---|---|
| private void processEncoderInstruction(ByteBuffer buffer) This method is invoked when the decoder's stream reader has data available for reading. | |
| resetInsertionsCounter | back to summary |
|---|---|
| public void resetInsertionsCounter() | |
| submitDecoderInstruction | back to summary |
|---|---|
| private void submitDecoderInstruction(DecoderInstructionsWriter decoderInstructionsWriter, int size) | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public void | onCapacityUpdate(long capacity)
Implements jdk.
|
| public void | |
| public void | onInsert(String name, String value)
Implements jdk.
|
| public void | onInsertIndexedName(boolean indexInStaticTable, long nameIndex, String valueString)
Implements jdk.
|
| DecoderTableCallback | back to summary |
|---|---|
| private DecoderTableCallback() | |
| ensureInstructionsAllowed | back to summary |
|---|---|
| private void ensureInstructionsAllowed() | |
| onCapacityUpdate | back to summary |
|---|---|
| public void onCapacityUpdate(long capacity) Implements jdk.
| |
| onDuplicate | back to summary |
|---|---|
| public void onDuplicate(long l) Implements jdk.
| |
| onInsert | back to summary |
|---|---|
| public void onInsert(String name, String value) Implements jdk.
| |
| onInsertIndexedName | back to summary |
|---|---|
| public void onInsertIndexedName(boolean indexInStaticTable, long nameIndex, String valueString) Implements jdk.
| |