Class Encoder

java.lang.Object
com.aayushatharva.brotli4j.encoder.Encoder
Direct Known Subclasses:
BrotliEncoderChannel

public class Encoder extends Object
Base class for OutputStream / Channel implementations.
  • Method Details

    • compress

      public static byte[] compress(byte[] data, Encoder.Parameters params) throws IOException
      Encodes the given data buffer.
      Parameters:
      data - byte array to be compressed
      params - Encoder.Parameters instance
      Returns:
      compressed byte array
      Throws:
      IOException - If any failure during encoding
    • compress

      public static byte[] compress(byte[] data) throws IOException
      Throws:
      IOException
    • prepareDictionary

      public static PreparedDictionary prepareDictionary(ByteBuffer dictionary, int sharedDictionaryType)
      Prepares raw or serialized dictionary for being used by encoder.
      Parameters:
      dictionary - raw / serialized dictionary data; MUST be direct
      sharedDictionaryType - dictionary data type
      Returns:
      PreparedDictionary instance
    • attachDictionary

      public void attachDictionary(PreparedDictionary dictionary) throws IOException
      Throws:
      IOException