Class Decoder

java.lang.Object
org.bluezoo.gumdrop.http.hpack.Decoder

public class Decoder extends Object
HPACK header block decoder (RFC 7541).

Decodes a compressed field block into HTTP/2 header fields using:

  • Indexed header field representation (RFC 7541 section 6.1)
  • Literal header field with incremental indexing (section 6.2.1)
  • Literal header field without indexing (section 6.2.2)
  • Literal header field never indexed (section 6.2.3)
  • Dynamic table size update (section 6.3)
  • Integer representation (section 5.1)
  • String literal / Huffman decoding (section 5.2)
Author:
Chris Burdess
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final List<Header>
    RFC 7541 Appendix A: Static Table Definition.
    protected static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Decoder(int headerTableSize)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Decode an HPACK-encoded sequence of bytes aka header block.
    protected static int
    RFC 7541 section 4.1: the size of an entry is the sum of its name's length in octets, its value's length in octets, and 32.
    static void
    main(String[] args)
     
    void
    Set the value of the SETTINGS_HEADER_TABLE_SIZE setting.
    protected static int
    RFC 7541 section 4.1: the size of a dynamic table is the sum of the size of its entries.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • STATIC_TABLE

      protected static final List<Header> STATIC_TABLE
      RFC 7541 Appendix A: Static Table Definition. 61 entries (indices 1-61); index 0 is null (unused).
    • STATIC_TABLE_SIZE

      protected static final int STATIC_TABLE_SIZE
  • Constructor Details

    • Decoder

      public Decoder(int headerTableSize)
      Constructor.
      Parameters:
      headerTableSize - the negotiated maximum size in bytes that the dynamic table is allowed to reach
  • Method Details

    • setHeaderTableSize

      public void setHeaderTableSize(int size)
      Set the value of the SETTINGS_HEADER_TABLE_SIZE setting.
    • decode

      public void decode(ByteBuffer buf, HeaderHandler handler) throws IOException
      Decode an HPACK-encoded sequence of bytes aka header block.
      Parameters:
      buf - the header block
      Throws:
      IOException
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception
    • tableSize

      protected static int tableSize(List<Header> table)
      RFC 7541 section 4.1: the size of a dynamic table is the sum of the size of its entries.
    • headerSize

      protected static int headerSize(Header header)
      RFC 7541 section 4.1: the size of an entry is the sum of its name's length in octets, its value's length in octets, and 32. Calculated using uncompressed lengths (no Huffman encoding applied).