Class Encoder
- java.lang.Object
-
- com.aayushatharva.brotli4j.encoder.Encoder
-
- Direct Known Subclasses:
BrotliEncoderChannel
public class Encoder extends java.lang.ObjectBase class for OutputStream / Channel implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEncoder.Modehttps://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.hstatic classEncoder.ParametersBrotli encoder settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachDictionary(PreparedDictionary dictionary)static byte[]compress(byte[] data)static byte[]compress(byte[] data, Encoder.Parameters params)Encodes the given data buffer.static PreparedDictionaryprepareDictionary(java.nio.ByteBuffer dictionary, int sharedDictionaryType)Prepares raw or serialized dictionary for being used by encoder.
-
-
-
Method Detail
-
compress
public static byte[] compress(byte[] data, Encoder.Parameters params) throws java.io.IOExceptionEncodes the given data buffer.- Parameters:
data- byte array to be compressedparams-Encoder.Parametersinstance- 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 directsharedDictionaryType- dictionary data type- Returns:
PreparedDictionaryinstance
-
attachDictionary
public void attachDictionary(PreparedDictionary dictionary) throws java.io.IOException
- Throws:
java.io.IOException
-
-