Class Encoder

  • Direct Known Subclasses:
    BrotliEncoderChannel

    public class Encoder
    extends java.lang.Object
    Base class for OutputStream / Channel implementations.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Encoder.Mode
      https://www.brotli.org/encode.html#aa6f See encode.h, typedef enum BrotliEncoderMode Important: The ordinal value of the modes should be the same as the constant values in encode.h
      static class  Encoder.Parameters
      Brotli encoder settings.
    • Method Detail

      • compress

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

        public static byte[] compress​(byte[] data)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • prepareDictionary

        public static PreparedDictionary prepareDictionary​(java.nio.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 java.io.IOException
        Throws:
        java.io.IOException