Class Encoder
java.lang.Object
com.aayushatharva.brotli4j.encoder.Encoder
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
BrotliEncoderChannel
Base class for OutputStream / Channel implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum... See encode.h, typedef enum BrotliEncoderModestatic final classBrotli encoder settings. -
Constructor Summary
ConstructorsConstructorDescriptionEncoder(WritableByteChannel destination, Encoder.Parameters params, int inputBufferSize) Creates a Encoder wrapper. -
Method Summary
Modifier and TypeMethodDescriptionvoidattachDictionary(PreparedDictionary dictionary) voidclose()static byte[]compress(byte[] data) static byte[]compress(byte[] data, int offset, int length) static byte[]compress(byte[] data, int offset, int length, Encoder.Parameters params) static byte[]compress(byte[] data, Encoder.Parameters params) booleanvoidflush()static PreparedDictionaryprepareDictionary(ByteBuffer dictionary, int sharedDictionaryType) Prepares raw or serialized dictionary for being used by encoder.
-
Constructor Details
-
Encoder
public Encoder(WritableByteChannel destination, Encoder.Parameters params, int inputBufferSize) throws IOException Creates a Encoder wrapper.- Parameters:
destination- underlying destinationparams- encoding parametersinputBufferSize- read buffer size- Throws:
IOException
-
-
Method Details
-
compress
public static byte[] compress(byte[] data, int offset, int length, Encoder.Parameters params) throws IOException - Throws:
IOException
-
compress
- Throws:
IOException
-
compress
- Throws:
IOException
-
compress
- Throws:
IOException
-
prepareDictionary
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
- Throws:
IOException
-
encode
- Returns:
- true if there is space in inputBuffer.
- Throws:
IOException
-
flush
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-