Class HPackHuffman

  • public class HPackHuffman
    extends Object
    • Constructor Detail

      • HPackHuffman

        public HPackHuffman()
    • Method Detail

      • decode

        public static void decode​(ByteBuffer data,
                                  int length,
                                  StringBuilder target)
                           throws org.apache.coyote.http2.HpackException
        Decodes a huffman encoded string into the target StringBuilder. There must be enough space left in the buffer for this method to succeed.
        data - The byte buffer
        length - The length of data from the buffer to decode
        target - The target for the decompressed data
        org.apache.coyote.http2.HpackException - If the Huffman encoded value in HPACK headers did not end with EOS padding
      • encode

        public static boolean encode​(ByteBuffer buffer,
                                     String toEncode,
                                     boolean forceLowercase)
        Encodes the given string into the buffer. If there is not enough space in the buffer, or the encoded version is bigger than the original it will return false and not modify the buffers position.
        buffer - The buffer to encode into
        toEncode - The string to encode
        forceLowercase - If the string should be encoded in lower case
        true if encoding succeeded