Class HuffmanEncoder

java.lang.Object
org.eclipse.jetty.http.compression.HuffmanEncoder

public class HuffmanEncoder extends Object

Used to encode strings Huffman encoding.

Characters are encoded with ISO-8859-1, if any multi-byte characters or control characters are present the encoder will throw EncodingException.

  • Method Details

    • octetsNeeded

      public static int octetsNeeded(String s)
      Parameters:
      s - the string to encode.
      Returns:
      the number of octets needed to encode the string, or -1 if it cannot be encoded.
    • octetsNeeded

      public static int octetsNeeded(byte[] b)
      Parameters:
      b - the byte array to encode.
      Returns:
      the number of octets needed to encode the bytes, or -1 if it cannot be encoded.
    • encode

      public static void encode(ByteBuffer buffer, String s)
      Parameters:
      buffer - the buffer to encode into.
      s - the string to encode.
    • octetsNeededLowerCase

      public static int octetsNeededLowerCase(String s)
      Parameters:
      s - the string to encode in lowercase.
      Returns:
      the number of octets needed to encode the string, or -1 if it cannot be encoded.
    • encodeLowerCase

      public static void encodeLowerCase(ByteBuffer buffer, String s)
      Parameters:
      buffer - the buffer to encode into in lowercase.
      s - the string to encode.