Top Description Methods
jdk.internal.net.http.hpack

public Interface DecodingCallback

Annotations
@FunctionalInterface
Imports
java.nio.ByteBuffer

Delivers results of the decoding operation.

Methods of the callback are never called by a decoder with any of the arguments being null.

API Note

The callback provides methods for all possible binary representations. This could be useful for implementing an intermediary, logging, debugging, etc.

The callback is an interface in order to interoperate with lambdas (in the most common use case):

DecodingCallback callback = (name, value) -> System.out.println(name + ", " + value);

Names and values are CharSequences rather than Strings in order to allow users to decide whether or not they need to create objects. A CharSequence might be used in-place, for example, to be appended to an Appendable (e.g. StringBuilder) and then discarded.

That said, if a passed CharSequence needs to outlast the method call, it needs to be copied.

Since
9

Method Summary

Modifier and TypeMethod and Description
public void
onDecoded(CharSequence
header name
name
,
CharSequence
header value
value
)

A method the more specific methods of the callback forward their calls to.

public default void
onDecoded(CharSequence
header name
name
,
CharSequence
header value
value
,
boolean
whether or not the value is sensitive
sensitive
)

A more finer-grained version of onDecoded(CharSequence, CharSequence) that also reports on value sensitivity.

public default void
onIndexed(int
index of an entry in the table
index
,
CharSequence
header name
name
,
CharSequence
header value
value
)

An Indexed Header Field decoded.

public default void
onLiteral(int
index of an entry in the table
index
,
CharSequence
header name
name
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field without Indexing decoded, where a name was referred by an index.

public default void
onLiteral(CharSequence
header name
name
,
boolean
if the name was Huffman encoded
nameHuffman
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field without Indexing decoded, where both a name and a value were literal.

public default void
onLiteralNeverIndexed(int
index of an entry in the table
index
,
CharSequence
header name
name
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field Never Indexed decoded, where a name was referred by an index.

public default void
onLiteralNeverIndexed(CharSequence
header name
name
,
boolean
if the name was Huffman encoded
nameHuffman
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field Never Indexed decoded, where both a name and a value were literal.

public default void
onLiteralWithIndexing(int
index of an entry in the table
index
,
CharSequence
header name
name
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field with Incremental Indexing decoded, where a name was referred by an index.

public default void
onLiteralWithIndexing(CharSequence
header name
name
,
boolean
if the name was Huffman encoded
nameHuffman
,
CharSequence
header value
value
,
boolean
if the value was Huffman encoded
valueHuffman
)

A Literal Header Field with Incremental Indexing decoded, where both a name and a value were literal.

public default void
onSizeUpdate(int
new capacity of the header table
capacity
)

A Dynamic Table Size Update decoded.

Method Detail

onDecodedback to summary
public void onDecoded(CharSequence name, CharSequence value)

A method the more specific methods of the callback forward their calls to.

Parameters
name:CharSequence

header name

value:CharSequence

header value

onDecodedback to summary
public default void onDecoded(CharSequence name, CharSequence value, boolean sensitive)

A more finer-grained version of onDecoded(CharSequence, CharSequence) that also reports on value sensitivity.

Value sensitivity must be considered, for example, when implementing an intermediary. A value is sensitive if it was represented as Literal Header Field Never Indexed.

It is required that intermediaries MUST use the same representation for encoding this header field in order to protect its value which is not to be put at risk by compressing it.

Implementation Specification

The default implementation invokes onDecoded(name, value).

Parameters
name:CharSequence

header name

value:CharSequence

header value

sensitive:boolean

whether or not the value is sensitive

See Also
onLiteralNeverIndexed(int, CharSequence, CharSequence, boolean), onLiteralNeverIndexed(CharSequence, boolean, CharSequence, boolean)
onIndexedback to summary
public default void onIndexed(int index, CharSequence name, CharSequence value)

An Indexed Header Field decoded.

Implementation Specification

The default implementation invokes onDecoded(name, value, false).

Parameters
index:int

index of an entry in the table

name:CharSequence

header name

value:CharSequence

header value

onLiteralback to summary
public default void onLiteral(int index, CharSequence name, CharSequence value, boolean valueHuffman)

A Literal Header Field without Indexing decoded, where a name was referred by an index.

Implementation Specification

The default implementation invokes onDecoded(name, value, false).

Parameters
index:int

index of an entry in the table

name:CharSequence

header name

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onLiteralback to summary
public default void onLiteral(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman)

A Literal Header Field without Indexing decoded, where both a name and a value were literal.

Implementation Specification

The default implementation invokes onDecoded(name, value, false).

Parameters
name:CharSequence

header name

nameHuffman:boolean

if the name was Huffman encoded

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onLiteralNeverIndexedback to summary
public default void onLiteralNeverIndexed(int index, CharSequence name, CharSequence value, boolean valueHuffman)

A Literal Header Field Never Indexed decoded, where a name was referred by an index.

Implementation Specification

The default implementation invokes onDecoded(name, value, true).

Parameters
index:int

index of an entry in the table

name:CharSequence

header name

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onLiteralNeverIndexedback to summary
public default void onLiteralNeverIndexed(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman)

A Literal Header Field Never Indexed decoded, where both a name and a value were literal.

Implementation Specification

The default implementation invokes onDecoded(name, value, true).

Parameters
name:CharSequence

header name

nameHuffman:boolean

if the name was Huffman encoded

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onLiteralWithIndexingback to summary
public default void onLiteralWithIndexing(int index, CharSequence name, CharSequence value, boolean valueHuffman)

A Literal Header Field with Incremental Indexing decoded, where a name was referred by an index.

Implementation Specification

The default implementation invokes onDecoded(name, value, false).

Parameters
index:int

index of an entry in the table

name:CharSequence

header name

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onLiteralWithIndexingback to summary
public default void onLiteralWithIndexing(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman)

A Literal Header Field with Incremental Indexing decoded, where both a name and a value were literal.

Implementation Specification

The default implementation invokes onDecoded(name, value, false).

Parameters
name:CharSequence

header name

nameHuffman:boolean

if the name was Huffman encoded

value:CharSequence

header value

valueHuffman:boolean

if the value was Huffman encoded

onSizeUpdateback to summary
public default void onSizeUpdate(int capacity)

A Dynamic Table Size Update decoded.

Implementation Specification

The default implementation does nothing.

Parameters
capacity:int

new capacity of the header table