Package org.opensearch.compress
Class ZstdCompressor
java.lang.Object
org.opensearch.compress.ZstdCompressor
- All Implemented Interfaces:
org.opensearch.core.compress.Compressor
Compressor implementation based on the ZSTD compression algorithm.- Opensearch.api:
- - registered name requires BWC support
- Opensearch.experimental:
- - class methods might change
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.opensearch.core.common.bytes.BytesReferencecompress(org.opensearch.core.common.bytes.BytesReference bytesReference) Always throws anUnsupportedOperationExceptionas ZSTD compression is supported only for snapshottingintReturns the length of theHEADERbooleanisCompressed(org.opensearch.core.common.bytes.BytesReference bytes) Compares the given bytes with theHEADERof a compressed streamReturns a newZstdInputStreamNoFinalizerfrom the given compressedInputStreamReturns a newZstdOutputStreamNoFinalizerfrom the givenOutputStreamorg.opensearch.core.common.bytes.BytesReferenceuncompress(org.opensearch.core.common.bytes.BytesReference bytesReference) Always throws anUnsupportedOperationExceptionas ZSTD compression is supported only for snapshotting
-
Field Details
-
NAME
The name to register the compressor by- See Also:
- Opensearch.api:
- - requires BWC support
-
-
Constructor Details
-
ZstdCompressor
public ZstdCompressor()
-
-
Method Details
-
isCompressed
public boolean isCompressed(org.opensearch.core.common.bytes.BytesReference bytes) Compares the given bytes with theHEADERof a compressed stream- Specified by:
isCompressedin interfaceorg.opensearch.core.compress.Compressor- Parameters:
bytes- the bytes to compare to (HEADER)- Returns:
- true if the bytes are the
HEADER, false otherwise
-
headerLength
public int headerLength()Returns the length of theHEADER- Specified by:
headerLengthin interfaceorg.opensearch.core.compress.Compressor- Returns:
- the
HEADERlength
-
threadLocalInputStream
Returns a newZstdInputStreamNoFinalizerfrom the given compressedInputStream- Specified by:
threadLocalInputStreamin interfaceorg.opensearch.core.compress.Compressor- Parameters:
in- the compressedInputStream- Returns:
- a new
ZstdInputStreamNoFinalizerfrom the given compressedInputStream - Throws:
IOException- if an I/O error occursIllegalArgumentException- if the input stream is not compressed with ZSTD
-
threadLocalOutputStream
Returns a newZstdOutputStreamNoFinalizerfrom the givenOutputStream- Specified by:
threadLocalOutputStreamin interfaceorg.opensearch.core.compress.Compressor- Parameters:
out- theOutputStream- Returns:
- a new
ZstdOutputStreamNoFinalizerfrom the givenOutputStream - Throws:
IOException- if an I/O error occurs
-
uncompress
public org.opensearch.core.common.bytes.BytesReference uncompress(org.opensearch.core.common.bytes.BytesReference bytesReference) throws IOException Always throws anUnsupportedOperationExceptionas ZSTD compression is supported only for snapshotting- Specified by:
uncompressin interfaceorg.opensearch.core.compress.Compressor- Parameters:
bytesReference- a reference to the bytes to uncompress- Returns:
- always throws an exception
- Throws:
UnsupportedOperationException- if the method is calledIOException- is never thrown
-
compress
public org.opensearch.core.common.bytes.BytesReference compress(org.opensearch.core.common.bytes.BytesReference bytesReference) throws IOException Always throws anUnsupportedOperationExceptionas ZSTD compression is supported only for snapshotting- Specified by:
compressin interfaceorg.opensearch.core.compress.Compressor- Parameters:
bytesReference- a reference to the bytes to compress- Returns:
- always throws an exception
- Throws:
UnsupportedOperationException- if the method is calledIOException
-