Package org.opensearch.core.compress
Interface Compressor
- All Known Implementing Classes:
NoneCompressor
@ExperimentalApi
@PublicApi(since="2.10.0")
public interface Compressor
Compressor interface used for compressing
MediaType and
org.opensearch.repositories.blobstore.BlobStoreRepository implementations.
This is not to be confused with Compressor which is used
for codec implementations such as org.opensearch.index.codec.customcodecs.Lucene95CustomCodec
for compressing StoredFields
- Opensearch.api:
- - intended to be extended
- Opensearch.experimental:
- - however, bwc is not guaranteed at this time
-
Method Summary
Modifier and TypeMethodDescriptioncompress(BytesReference bytesReference) Compress bytes into a newly allocated buffer.intbooleanisCompressed(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.
-
Method Details
-
isCompressed
-
headerLength
int headerLength() -
threadLocalInputStream
Creates 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- Throws:
IOException
-
threadLocalOutputStream
Creates 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- Throws:
IOException
-
uncompress
Decompress bytes into a newly allocated buffer.- Parameters:
bytesReference- bytes to decompress- Returns:
- decompressed bytes
- Throws:
IOException
-
compress
Compress bytes into a newly allocated buffer.- Parameters:
bytesReference- bytes to compress- Returns:
- compressed bytes
- Throws:
IOException
-