Typical lifecycle looks like this:
API Note
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 static final AtomicLong | |
| private boolean | |
| private boolean | |
| private final long | |
| private int | |
| private final IntegerReader | |
| private int | |
| private final HPACK. | |
| private final int | |
| private final int | |
| private final StringBuilder | |
| private boolean | |
| private long | |
| private Decoder. | |
| private static final List | |
| private final StringReader | |
| private final SimpleHeaderTable | |
| private final StringBuilder | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | Decoder(int
a non-negative integer capacity)Constructs a |
| public | Decoder(int
a non-negative integer capacity, int a maximum value for the header list size. This is the uncompressed
names size + uncompressed values size + 32 bytes per field line maxHeaderListSize, int the maximum number of literal with indexing we're prepared to handle
for a header field section maxIndexed)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private boolean | |
| public void | decode(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, DecodingCallback the callback consumer)Decodes a header block from the given buffer to the given callback. |
| private SimpleHeaderTable. | |
| pack-priv SimpleHeaderTable | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| public void | |
| private void |
| capacity | back to summary |
|---|---|
| private int capacity | |
| DECODERS_IDS | back to summary |
|---|---|
| private static final AtomicLong DECODERS_IDS | |
| firstValueIndex | back to summary |
|---|---|
| private boolean firstValueIndex | |
| firstValueRead | back to summary |
|---|---|
| private boolean firstValueRead | |
| id | back to summary |
|---|---|
| private final long id | |
| indexed | back to summary |
|---|---|
| private int indexed | |
| integerReader | back to summary |
|---|---|
| private final IntegerReader integerReader | |
| intValue | back to summary |
|---|---|
| private int intValue | |
| logger | back to summary |
|---|---|
| private final HPACK. | |
| maxHeaderListSize | back to summary |
|---|---|
| private final int maxHeaderListSize | |
| maxIndexed | back to summary |
|---|---|
| private final int maxIndexed | |
| name | back to summary |
|---|---|
| private final StringBuilder name | |
| nameHuffmanEncoded | back to summary |
|---|---|
| private boolean nameHuffmanEncoded | |
| size | back to summary |
|---|---|
| private long size | |
| state | back to summary |
|---|---|
| private Decoder. | |
| states | back to summary |
|---|---|
| private static final List<Decoder. | |
| stringReader | back to summary |
|---|---|
| private final StringReader stringReader | |
| table | back to summary |
|---|---|
| private final SimpleHeaderTable 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).
| |
| Decoder | back to summary |
|---|---|
| public Decoder(int capacity, int maxHeaderListSize, int maxIndexed) Constructs a The value of the capacity 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).
| |
| checkMaxHeaderListSize | back to summary |
|---|---|
| private void checkMaxHeaderListSize(long sz, DecodingCallback consumer) throws ProtocolException | |
| cleanUpAfterReading | back to summary |
|---|---|
| private void cleanUpAfterReading() | |
| completeReading | back to summary |
|---|---|
| private boolean completeReading(ByteBuffer input, DecodingCallback action) throws IOException | |
| decode | back to summary |
|---|---|
| public void decode(ByteBuffer headerBlock, boolean endOfHeaderBlock, DecodingCallback consumer) throws IOException 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 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.
| |
| getHeaderFieldAt | back to summary |
|---|---|
| private SimpleHeaderTable. | |
| getTable | back to summary |
|---|---|
| pack-priv SimpleHeaderTable getTable() | |
| proceed | back to summary |
|---|---|
| private void proceed(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeIndexed | back to summary |
|---|---|
| private void resumeIndexed(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeLiteral | back to summary |
|---|---|
| private void resumeLiteral(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeLiteralNeverIndexed | back to summary |
|---|---|
| private void resumeLiteralNeverIndexed(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeLiteralWithIndexing | back to summary |
|---|---|
| private void resumeLiteralWithIndexing(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeReady | back to summary |
|---|---|
| private void resumeReady(ByteBuffer input, DecodingCallback action) throws IOException | |
| resumeSizeUpdate | back to summary |
|---|---|
| private void resumeSizeUpdate(ByteBuffer input, DecodingCallback action) throws IOException | |
| 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).
| |
| setMaxCapacity0 | back to summary |
|---|---|
| private void setMaxCapacity0(int capacity) | |
| 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. | |