final class HpackEncoder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
HpackEncoder.HeaderEntry
A linked hash map HpackHeaderField entry.
|
Modifier and Type | Field and Description |
---|---|
private byte |
hashMask |
private HpackEncoder.HeaderEntry |
head |
private HpackEncoder.HeaderEntry[] |
headerFields |
private HpackHuffmanEncoder |
hpackHuffmanEncoder |
private boolean |
ignoreMaxHeaderListSize |
private long |
maxHeaderListSize |
private long |
maxHeaderTableSize |
private long |
size |
Constructor and Description |
---|
HpackEncoder()
Creates a new encoder.
|
HpackEncoder(boolean ignoreMaxHeaderListSize)
Creates a new encoder.
|
HpackEncoder(boolean ignoreMaxHeaderListSize,
int arraySizeHint)
Creates a new encoder.
|
Modifier and Type | Method and Description |
---|---|
private void |
add(java.lang.CharSequence name,
java.lang.CharSequence value,
long headerSize)
Add the header field to the dynamic table.
|
private void |
clear()
Remove all entries from the dynamic table.
|
private void |
encodeHeader(ByteBuf out,
java.lang.CharSequence name,
java.lang.CharSequence value,
boolean sensitive,
long headerSize)
Encode the header field into the header block.
|
void |
encodeHeaders(int streamId,
ByteBuf out,
Http2Headers headers,
Http2HeadersEncoder.SensitivityDetector sensitivityDetector)
Encode the header field into the header block.
|
private void |
encodeHeadersEnforceMaxHeaderListSize(int streamId,
ByteBuf out,
Http2Headers headers,
Http2HeadersEncoder.SensitivityDetector sensitivityDetector) |
private void |
encodeHeadersIgnoreMaxHeaderListSize(ByteBuf out,
Http2Headers headers,
Http2HeadersEncoder.SensitivityDetector sensitivityDetector) |
private static void |
encodeInteger(ByteBuf out,
int mask,
int n,
int i)
Encode integer according to Section 5.1.
|
private static void |
encodeInteger(ByteBuf out,
int mask,
int n,
long i)
Encode integer according to Section 5.1.
|
private void |
encodeLiteral(ByteBuf out,
java.lang.CharSequence name,
java.lang.CharSequence value,
HpackUtil.IndexType indexType,
int nameIndex)
Encode literal header field according to Section 6.2.
|
private void |
encodeStringLiteral(ByteBuf out,
java.lang.CharSequence string)
Encode string literal according to Section 5.2.
|
private void |
ensureCapacity(long headerSize)
Ensure that the dynamic table has enough room to hold 'headerSize' more bytes.
|
private HpackEncoder.HeaderEntry |
getEntry(java.lang.CharSequence name,
java.lang.CharSequence value)
Returns the header entry with the lowest index value for the header field.
|
(package private) HpackHeaderField |
getHeaderField(int index)
Return the header field at the given index.
|
private int |
getIndex(java.lang.CharSequence name)
Returns the lowest index value for the header field name in the dynamic table.
|
private int |
getIndex(int index)
Compute the index into the dynamic table given the index in the header entry.
|
long |
getMaxHeaderListSize() |
long |
getMaxHeaderTableSize()
Return the maximum table size.
|
private int |
getNameIndex(java.lang.CharSequence name) |
private int |
index(int h)
Returns the index into the hash table for the hash code h.
|
(package private) int |
length()
Return the number of header fields in the dynamic table.
|
private HpackHeaderField |
remove()
Remove and return the oldest header field from the dynamic table.
|
void |
setMaxHeaderListSize(long maxHeaderListSize) |
void |
setMaxHeaderTableSize(ByteBuf out,
long maxHeaderTableSize)
Set the maximum table size.
|
(package private) long |
size()
Return the size of the dynamic table.
|
private final HpackEncoder.HeaderEntry[] headerFields
private final HpackEncoder.HeaderEntry head
private final HpackHuffmanEncoder hpackHuffmanEncoder
private final byte hashMask
private final boolean ignoreMaxHeaderListSize
private long size
private long maxHeaderTableSize
private long maxHeaderListSize
HpackEncoder()
public HpackEncoder(boolean ignoreMaxHeaderListSize)
public HpackEncoder(boolean ignoreMaxHeaderListSize, int arraySizeHint)
public void encodeHeaders(int streamId, ByteBuf out, Http2Headers headers, Http2HeadersEncoder.SensitivityDetector sensitivityDetector) throws Http2Exception
CharSequence
s must be immutable!Http2Exception
private void encodeHeadersEnforceMaxHeaderListSize(int streamId, ByteBuf out, Http2Headers headers, Http2HeadersEncoder.SensitivityDetector sensitivityDetector) throws Http2Exception
Http2Exception
private void encodeHeadersIgnoreMaxHeaderListSize(ByteBuf out, Http2Headers headers, Http2HeadersEncoder.SensitivityDetector sensitivityDetector) throws Http2Exception
Http2Exception
private void encodeHeader(ByteBuf out, java.lang.CharSequence name, java.lang.CharSequence value, boolean sensitive, long headerSize)
CharSequence
s must be immutable!public void setMaxHeaderTableSize(ByteBuf out, long maxHeaderTableSize) throws Http2Exception
Http2Exception
public long getMaxHeaderTableSize()
public void setMaxHeaderListSize(long maxHeaderListSize) throws Http2Exception
Http2Exception
public long getMaxHeaderListSize()
private static void encodeInteger(ByteBuf out, int mask, int n, int i)
private static void encodeInteger(ByteBuf out, int mask, int n, long i)
private void encodeStringLiteral(ByteBuf out, java.lang.CharSequence string)
private void encodeLiteral(ByteBuf out, java.lang.CharSequence name, java.lang.CharSequence value, HpackUtil.IndexType indexType, int nameIndex)
private int getNameIndex(java.lang.CharSequence name)
private void ensureCapacity(long headerSize)
int length()
long size()
HpackHeaderField getHeaderField(int index)
private HpackEncoder.HeaderEntry getEntry(java.lang.CharSequence name, java.lang.CharSequence value)
private int getIndex(java.lang.CharSequence name)
private int getIndex(int index)
private void add(java.lang.CharSequence name, java.lang.CharSequence value, long headerSize)
private HpackHeaderField remove()
private void clear()
private int index(int h)