Class DecodingCallback
decoding operation.
Methods of the callback are never called by a decoder with any of the arguments being null.
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):
{
@code
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidonDecoded(CharSequence name, CharSequence value) A method the more specific methods of the callback forward their calls to.voidonDecoded(CharSequence name, CharSequence value, boolean sensitive) A more finer-grained version ofonDecoded(CharSequence, CharSequence)that also reports on value sensitivity.voidonIndexed(int index, CharSequence name, CharSequence value) An Indexed Header Field decoded.voidonLiteral(int index, CharSequence name, CharSequence value, boolean valueHuffman) voidonLiteral(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) voidonLiteralNeverIndexed(int index, CharSequence name, CharSequence value, boolean valueHuffman) voidonLiteralNeverIndexed(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) voidonLiteralWithIndexing(int index, CharSequence name, CharSequence value, boolean valueHuffman) voidonLiteralWithIndexing(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) A Literal Header Field with Incremental Indexing decoded, where both anameand avaluewere literal.voidonSizeUpdate(int capacity) A Dynamic Table Size Update decoded.
-
Constructor Details
-
DecodingCallback
public DecodingCallback()
-
-
Method Details
-
onDecoded
A method the more specific methods of the callback forward their calls to.- Parameters:
name- header namevalue- header value
-
onDecoded
A more finer-grained version ofonDecoded(CharSequence, CharSequence)that also reports on value sensitivity.Value sensitivity must be considered, for example, when implementing an intermediary. A
valueis 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.
The default implementation invokes
onDecoded(name, value).- Parameters:
name- header namevalue- header valuesensitive- whether or not the value is sensitive- See Also:
-
onIndexed
An Indexed Header Field decoded.The default implementation invokes
onDecoded(name, value, false).- Parameters:
index- index of an entry in the tablename- header namevalue- header value
-
onLiteral
A Literal Header Field without Indexing decoded, where anamewas referred by anindex.The default implementation invokes
onDecoded(name, value, false).- Parameters:
index- index of an entry in the tablename- header namevalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onLiteral
public void onLiteral(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) A Literal Header Field without Indexing decoded, where both anameand avaluewere literal.The default implementation invokes
onDecoded(name, value, false).- Parameters:
name- header namenameHuffman- if thenamewas Huffman encodedvalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onLiteralNeverIndexed
public void onLiteralNeverIndexed(int index, CharSequence name, CharSequence value, boolean valueHuffman) A Literal Header Field Never Indexed decoded, where anamewas referred by anindex.The default implementation invokes
onDecoded(name, value, true).- Parameters:
index- index of an entry in the tablename- header namevalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onLiteralNeverIndexed
public void onLiteralNeverIndexed(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) A Literal Header Field Never Indexed decoded, where both anameand avaluewere literal.The default implementation invokes
onDecoded(name, value, true).- Parameters:
name- header namenameHuffman- if thenamewas Huffman encodedvalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onLiteralWithIndexing
public void onLiteralWithIndexing(int index, CharSequence name, CharSequence value, boolean valueHuffman) A Literal Header Field with Incremental Indexing decoded, where anamewas referred by anindex.The default implementation invokes
onDecoded(name, value, false).- Parameters:
index- index of an entry in the tablename- header namevalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onLiteralWithIndexing
public void onLiteralWithIndexing(CharSequence name, boolean nameHuffman, CharSequence value, boolean valueHuffman) A Literal Header Field with Incremental Indexing decoded, where both anameand avaluewere literal.The default implementation invokes
onDecoded(name, value, false).- Parameters:
name- header namenameHuffman- if thenamewas Huffman encodedvalue- header valuevalueHuffman- if thevaluewas Huffman encoded
-
onSizeUpdate
public void onSizeUpdate(int capacity) A Dynamic Table Size Update decoded.The default implementation does nothing.
- Parameters:
capacity- new capacity of the header table
-