Typical lifecycle looks like this:
new Decoder (setMaxCapacity?
decode)*
The design intentions behind Decoder were to facilitate flexible and incremental style of processing.
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 a 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 static enum |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private boolean | |
| private boolean | |
| private final IntegerReader | |
| private int | |
| private final StringBuilder | |
| private boolean | |
| private Decoder. | |
| private static final Decoder. | |
| private final StringReader | |
| private final HeaderTable | |
| private final StringBuilder | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | Decoder(int
a non-negative integer capacity)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private boolean | |
| public void | decode(Buffer
the chunk of the header block, may be empty headerBlockChunk, boolean true if the chunk is the final (or the only one) in the sequence finalChunk, DecodingCallback the callback consumer)Decodes a header block from the given buffer to the given callback. |
| pack-priv HeaderTable | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| public void |
| capacity | back to summary |
|---|---|
| private int capacity | |
| firstValueIndex | back to summary |
|---|---|
| private boolean firstValueIndex | |
| firstValueRead | back to summary |
|---|---|
| private boolean firstValueRead | |
| integerReader | back to summary |
|---|---|
| private final IntegerReader integerReader | |
| intValue | back to summary |
|---|---|
| private int intValue | |
| name | back to summary |
|---|---|
| private final StringBuilder name | |
| nameHuffmanEncoded | back to summary |
|---|---|
| private boolean nameHuffmanEncoded | |
| state | back to summary |
|---|---|
| private Decoder. | |
| states | back to summary |
|---|---|
| private static final Decoder. | |
| stringReader | back to summary |
|---|---|
| private final StringReader stringReader | |
| table | back to summary |
|---|---|
| private final HeaderTable table | |
| value | back to summary |
|---|---|
| private final StringBuilder value | |
| valueHuffmanEncoded | back to summary |
|---|---|
| private boolean valueHuffmanEncoded | |
| Decoder | back to summary |
|---|---|
| public Decoder(int capacity) Constructs a The value has to be agreed between decoder and encoder out-of-band, e.g. by a protocol that uses HPACK (see 4.2. Maximum Table Size).
| |
| cleanUpAfterReading | back to summary |
|---|---|
| private void cleanUpAfterReading() | |
| completeReading | back to summary |
|---|---|
| private boolean completeReading(Buffer input) | |
| decode | back to summary |
|---|---|
| public void decode(Buffer headerBlockChunk, boolean finalChunk, DecodingCallback consumer) Decodes a header block from the given buffer to the given callback.
Suppose a header block is represented by a sequence of
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, the callback method is not called.
In addition to exceptions thrown directly by the method, any exceptions thrown from the
| |
| getTable | back to summary |
|---|---|
| pack-priv HeaderTable getTable() | |
| proceed | back to summary |
|---|---|
| private void proceed(Buffer input, DecodingCallback action, boolean endOfHeaderBlock) | |
| resumeIndexed | back to summary |
|---|---|
| private void resumeIndexed(Buffer input, DecodingCallback action) | |
| resumeLiteral | back to summary |
|---|---|
| private void resumeLiteral(Buffer input, DecodingCallback action) | |
| resumeLiteralNeverIndexed | back to summary |
|---|---|
| private void resumeLiteralNeverIndexed(Buffer input, DecodingCallback action) | |
| resumeLiteralWithIndexing | back to summary |
|---|---|
| private void resumeLiteralWithIndexing(Buffer input, DecodingCallback action) | |
| resumeReady | back to summary |
|---|---|
| private void resumeReady(Buffer input) | |
| resumeSizeUpdate | back to summary |
|---|---|
| private void resumeSizeUpdate(Buffer input, DecodingCallback action) | |
| setMaxCapacity | back to summary |
|---|---|
| public void setMaxCapacity(int capacity) Sets a maximum capacity of the header table. The value has to be agreed between decoder and encoder out-of-band, e.g. by a protocol that uses HPACK (see 4.2. Maximum Table Size).
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final Decoder. | |
| public static final Decoder. | |
| public static final Decoder. | |
| public static final Decoder. | |
| public static final Decoder. | |
| public static final Decoder. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Decoder. | |
| public static Decoder. |
| INDEXED | back to summary |
|---|---|
| public static final Decoder. | |
| LITERAL | back to summary |
|---|---|
| public static final Decoder. | |
| LITERAL_NEVER_INDEXED | back to summary |
|---|---|
| public static final Decoder. | |
| LITERAL_WITH_INDEXING | back to summary |
|---|---|
| public static final Decoder. | |
| READY | back to summary |
|---|---|
| public static final Decoder. | |
| SIZE_UPDATE | back to summary |
|---|---|
| public static final Decoder. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static Decoder. | |
| values | back to summary |
|---|---|
| public static Decoder. | |