Class Encoder
- java.lang.Object
-
- com.aayushatharva.brotli4j.encoder.Encoder
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
BrotliEncoderChannel
public class Encoder extends java.lang.Object implements java.lang.AutoCloseableBase class for OutputStream / Channel implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEncoder.Mode... See encode.h, typedef enum BrotliEncoderModestatic classEncoder.ParametersBrotli encoder settings.
-
Constructor Summary
Constructors Constructor Description Encoder(java.nio.channels.WritableByteChannel destination, Encoder.Parameters params, int inputBufferSize)Creates a Encoder wrapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachDictionary(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)booleanencode(EncoderJNI.Operation op)voidflush()static PreparedDictionaryprepareDictionary(java.nio.ByteBuffer dictionary, int sharedDictionaryType)Prepares raw or serialized dictionary for being used by encoder.
-
-
-
Constructor Detail
-
Encoder
public Encoder(java.nio.channels.WritableByteChannel destination, Encoder.Parameters params, int inputBufferSize) throws java.io.IOExceptionCreates a Encoder wrapper.- Parameters:
destination- underlying destinationparams- encoding parametersinputBufferSize- read buffer size- Throws:
java.io.IOException
-
-
Method Detail
-
compress
public static byte[] compress(byte[] data, int offset, int length, Encoder.Parameters params) throws java.io.IOException- Throws:
java.io.IOException
-
compress
public static byte[] compress(byte[] data) throws java.io.IOException- Throws:
java.io.IOException
-
compress
public static byte[] compress(byte[] data, Encoder.Parameters params) throws java.io.IOException- Throws:
java.io.IOException
-
compress
public static byte[] compress(byte[] data, int offset, int length) 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
-
encode
public boolean encode(EncoderJNI.Operation op) throws java.io.IOException
- Returns:
- true if there is space in inputBuffer.
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.io.IOException
-
-