Package org.brotli.wrapper.enc
Class Encoder
java.lang.Object
org.brotli.wrapper.enc.Encoder
- Direct Known Subclasses:
BrotliEncoderChannel
Base class for OutputStream / Channel implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
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 final class
Brotli encoder settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBuffer
(package private) boolean
private final WritableByteChannel
private final List
<PreparedDictionary> private final EncoderJNI.Wrapper
(package private) final ByteBuffer
-
Constructor Summary
ConstructorsConstructorDescriptionEncoder
(WritableByteChannel destination, Encoder.Parameters params, int inputBufferSize) Creates a Encoder wrapper. -
Method Summary
Modifier and TypeMethodDescriptionvoid
attachDictionary
(PreparedDictionary dictionary) (package private) void
close()
static byte[]
compress
(byte[] data) static byte[]
compress
(byte[] data, Encoder.Parameters params) Encodes the given data buffer.(package private) boolean
private void
(package private) void
flush()
static PreparedDictionary
prepareDictionary
(ByteBuffer dictionary, int sharedDictionaryType) Prepares raw or serialized dictionary for being used by encoder.(package private) boolean
pushOutput
(boolean force)
-
Field Details
-
destination
-
dictionaries
-
encoder
-
buffer
-
inputBuffer
-
closed
boolean closed
-
-
Constructor Details
-
Encoder
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
-
fail
- Throws:
IOException
-
attachDictionary
- Throws:
IOException
-
pushOutput
- Parameters:
force
- repeat pushing until all output is consumed- Returns:
- true if all encoder output is consumed
- Throws:
IOException
-
encode
- Returns:
- true if there is space in inputBuffer.
- Throws:
IOException
-
flush
- Throws:
IOException
-
close
- Throws:
IOException
-
compress
Encodes the given data buffer.- 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
-