Class DeflateCompressor
java.lang.Object
org.elasticsearch.common.compress.DeflateCompressor
- All Implemented Interfaces:
Compressor
Compressor
implementation based on the DEFLATE compression algorithm.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncompress(BytesReference bytesReference)
Compress bytes into a newly allocated buffer.int
static InputStream
inputStream(InputStream in, boolean threadLocal)
Creates a new input stream that decompresses the contents read from the provided input stream.boolean
isCompressed(BytesReference bytes)
Creates a new input stream that decompresses the contents read from the provided input stream.Creates a new output stream that compresses the contents and writes to the provided output stream.uncompress(BytesReference bytesReference)
Decompress bytes into a newly allocated buffer.
-
Constructor Details
-
DeflateCompressor
public DeflateCompressor()
-
-
Method Details
-
isCompressed
- Specified by:
isCompressed
in interfaceCompressor
-
headerLength
public int headerLength()- Specified by:
headerLength
in interfaceCompressor
-
threadLocalInputStream
Description copied from interface:Compressor
Creates a new input stream that decompresses the contents read from the provided input stream. Closing the returnedInputStream
will close the provided stream input. Note: The returned stream may only be used on the thread that created it as it might use thread-local resources and must be safely closed after use- Specified by:
threadLocalInputStream
in interfaceCompressor
- Throws:
IOException
-
inputStream
Creates a new input stream that decompresses the contents read from the provided input stream. Closing the returned stream will close the provided input stream. Optionally uses thread-local, pooled resources to save off-heap allocations if the stream is guaranteed to not escape the current thread.- Parameters:
in
- input stream to wrapthreadLocal
- whether this stream will only be used on the current thread or not- Returns:
- decompressing stream
- Throws:
IOException
-
threadLocalOutputStream
Description copied from interface:Compressor
Creates a new output stream that compresses the contents and writes to the provided output stream. Closing the returnedOutputStream
will close the provided output stream. Note: The returned stream may only be used on the thread that created it as it might use thread-local resources and must be safely closed after use- Specified by:
threadLocalOutputStream
in interfaceCompressor
- Throws:
IOException
-
uncompress
Description copied from interface:Compressor
Decompress bytes into a newly allocated buffer.- Specified by:
uncompress
in interfaceCompressor
- Parameters:
bytesReference
- bytes to decompress- Returns:
- decompressed bytes
- Throws:
IOException
-
compress
Description copied from interface:Compressor
Compress bytes into a newly allocated buffer.- Specified by:
compress
in interfaceCompressor
- Parameters:
bytesReference
- bytes to compress- Returns:
- compressed bytes
- Throws:
IOException
-