Class DeflateCompressor
java.lang.Object
org.elasticsearch.common.compress.DeflateCompressor
- All Implemented Interfaces:
Compressor
Compressor implementation based on the DEFLATE compression algorithm.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompress(BytesReference bytesReference)Compress bytes into a newly allocated buffer.intstatic InputStreaminputStream(InputStream in, boolean threadLocal)Creates a new input stream that decompresses the contents read from the provided input stream.booleanisCompressed(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:
isCompressedin interfaceCompressor
-
headerLength
public int headerLength()- Specified by:
headerLengthin interfaceCompressor
-
threadLocalInputStream
Description copied from interface:CompressorCreates a new input stream that decompresses the contents read from the provided input stream. Closing the returnedInputStreamwill 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:
threadLocalInputStreamin 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:CompressorCreates a new output stream that compresses the contents and writes to the provided output stream. Closing the returnedOutputStreamwill 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:
threadLocalOutputStreamin interfaceCompressor- Throws:
IOException
-
uncompress
Description copied from interface:CompressorDecompress bytes into a newly allocated buffer.- Specified by:
uncompressin interfaceCompressor- Parameters:
bytesReference- bytes to decompress- Returns:
- decompressed bytes
- Throws:
IOException
-
compress
Description copied from interface:CompressorCompress bytes into a newly allocated buffer.- Specified by:
compressin interfaceCompressor- Parameters:
bytesReference- bytes to compress- Returns:
- compressed bytes
- Throws:
IOException
-