Class Encoder
- java.lang.Object
-
- com.aayushatharva.brotli4j.encoder.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.hstatic class
Encoder.Parameters
Brotli encoder settings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attachDictionary(PreparedDictionary dictionary)
static byte[]
compress(byte[] data)
static byte[]
compress(byte[] data, Encoder.Parameters params)
Encodes the given data buffer.static PreparedDictionary
prepareDictionary(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.IOException
Encodes the given data buffer.- Parameters:
data
- byte array to be compressedparams
-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 directsharedDictionaryType
- dictionary data type- Returns:
PreparedDictionary
instance
-
attachDictionary
public void attachDictionary(PreparedDictionary dictionary) throws java.io.IOException
- Throws:
java.io.IOException
-
-