C# Class hpack.Encoder

Show file Open project: ringostarr80/hpack

Public Methods

Method Description
EncodeHeader ( BinaryWriter output, byte name, byte value ) : void
EncodeHeader ( BinaryWriter output, byte name, byte value, bool sensitive ) : void

Encode the header field into the header block.

EncodeHeader ( BinaryWriter output, string name, string value ) : void
EncodeHeader ( BinaryWriter output, string name, string value, bool sensitive ) : void
Encoder ( int maxHeaderTableSize ) : System

Initializes a new instance of the hpack.Encoder class.

Encoder ( int maxHeaderTableSize, bool useIndexing, bool forceHuffmanOn, bool forceHuffmanOff ) : System

Initializes a new instance of the hpack.Encoder class. for testing only.

GetHeaderField ( int index ) : HeaderField

Return the header field at the given index. Exposed for testing.

GetMaxHeaderTableSize ( ) : int

Return the maximum table size.

GetSize ( ) : int

Return the size of the dynamic table. Exposed for testing.

Length ( ) : int

Return the number of header fields in the dynamic table. Exposed for testing.

SetMaxHeaderTableSize ( BinaryWriter output, int maxHeaderTableSize ) : void

Set the maximum table size.

Private Methods

Method Description
Add ( byte name, byte value ) : void

Add the header field to the dynamic table. Entries are evicted from the dynamic table until the size of the table and the new header field is less than the table's capacity. If the size of the new entry is larger than the table's capacity, the dynamic table will be cleared.

Clear ( ) : void

Remove all entries from the dynamic table.

EncodeInteger ( BinaryWriter output, int mask, int n, int i ) : void

Encode integer according to Section 5.1.

EncodeLiteral ( BinaryWriter output, byte name, byte value, HpackUtil indexType, int nameIndex ) : void

Encode literal header field according to Section 6.2.

EncodeStringLiteral ( BinaryWriter output, byte stringLiteral ) : void

Encode string literal according to Section 5.2.

EnsureCapacity ( int headerSize ) : void

Ensure that the dynamic table has enough room to hold 'headerSize' more bytes. Removes the oldest entry from the dynamic table until sufficient space is available.

GetEntry ( byte name, byte value ) : HeaderEntry

Returns the header entry with the lowest index value for the header field. Returns null if header field is not in the dynamic table.

GetIndex ( byte name ) : int

Returns the lowest index value for the header field name in the dynamic table. Returns -1 if the header field name is not in the dynamic table.

GetIndex ( int index ) : int

Compute the index into the dynamic table given the index in the header entry.

GetNameIndex ( byte name ) : int
Hash ( byte name ) : int

Returns the hash code for the given header field name.

Index ( int h ) : int

Returns the index into the hash table for the hash code h.

Init ( int maxHeaderTableSize, bool useIndexing, bool forceHuffmanOn, bool forceHuffmanOff ) : void
Remove ( ) : HeaderField

Remove and return the oldest header field from the dynamic table.

Method Details

EncodeHeader() public method

public EncodeHeader ( BinaryWriter output, byte name, byte value ) : void
output System.IO.BinaryWriter
name byte
value byte
return void

EncodeHeader() public method

Encode the header field into the header block.
public EncodeHeader ( BinaryWriter output, byte name, byte value, bool sensitive ) : void
output System.IO.BinaryWriter Output.
name byte Name.
value byte Value.
sensitive bool If set to true sensitive.
return void

EncodeHeader() public method

public EncodeHeader ( BinaryWriter output, string name, string value ) : void
output System.IO.BinaryWriter
name string
value string
return void

EncodeHeader() public method

public EncodeHeader ( BinaryWriter output, string name, string value, bool sensitive ) : void
output System.IO.BinaryWriter
name string
value string
sensitive bool
return void

Encoder() public method

Initializes a new instance of the hpack.Encoder class.
public Encoder ( int maxHeaderTableSize ) : System
maxHeaderTableSize int Max header table size.
return System

Encoder() public method

Initializes a new instance of the hpack.Encoder class. for testing only.
public Encoder ( int maxHeaderTableSize, bool useIndexing, bool forceHuffmanOn, bool forceHuffmanOff ) : System
maxHeaderTableSize int Max header table size.
useIndexing bool If set to true use indexing.
forceHuffmanOn bool If set to true force huffman on.
forceHuffmanOff bool If set to true force huffman off.
return System

GetHeaderField() public method

Return the header field at the given index. Exposed for testing.
public GetHeaderField ( int index ) : HeaderField
index int Index.
return HeaderField

GetMaxHeaderTableSize() public method

Return the maximum table size.
public GetMaxHeaderTableSize ( ) : int
return int

GetSize() public method

Return the size of the dynamic table. Exposed for testing.
public GetSize ( ) : int
return int

Length() public method

Return the number of header fields in the dynamic table. Exposed for testing.
public Length ( ) : int
return int

SetMaxHeaderTableSize() public method

Set the maximum table size.
public SetMaxHeaderTableSize ( BinaryWriter output, int maxHeaderTableSize ) : void
output System.IO.BinaryWriter Output.
maxHeaderTableSize int Max header table size.
return void