io.undertow.protocols.http2

## Class HPackHuffman

- java.lang.Object
- - io.undertow.protocols.http2.HPackHuffman

    public class HPackHuffman
    extends Object

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`protected static class` `HPackHuffman.HuffmanCode`

### Constructor Summary

Constructors
Constructor and Description
`HPackHuffman()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `decode(ByteBuffer data, int length, StringBuilder target)` Decodes a huffman encoded string into the target StringBuilder.
`static boolean` `encode(ByteBuffer buffer, String toEncode, boolean forceLowercase)` Encodes the given string into the buffer.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HPackHuffman

    public HPackHuffman()

### Method Detail

#### decode

    public static void decode(ByteBuffer data,
                              int length,
                              StringBuilder target)
                       throws HpackException

Decodes a huffman encoded string into the target StringBuilder. There must be enough space left in the buffer for this method to succeed.

Parameters:
  `data` - The byte buffer
  `length` - The data length
  `target` - The target for the decompressed data
Throws:
  `HpackException`

#### 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

Parameters:
  `buffer` - The buffer to encode into
  `toEncode` - The string to encode
  `forceLowercase` - If the string should be encoded in lower case
Returns:
  true if encoding succeeded