Package org.apache.cassandra.io.compress
Class ZstdCompressor
- java.lang.Object
-
- org.apache.cassandra.io.compress.ZstdCompressor
-
- All Implemented Interfaces:
ICompressor
public class ZstdCompressor extends java.lang.Object implements ICompressor
ZSTD Compressor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.io.compress.ICompressor
ICompressor.Uses
-
-
Field Summary
Fields Modifier and Type Field Description static intBEST_COMPRESSION_LEVELstatic java.lang.StringCOMPRESSION_LEVEL_OPTION_NAMEstatic intDEFAULT_COMPRESSION_LEVELstatic intFAST_COMPRESSION_LEVEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)Compress using ByteBuffersstatic ZstdCompressorcreate(java.util.Map<java.lang.String,java.lang.String> options)Create a Zstd compressor with the given optionsintgetCompressionLevel()static ZstdCompressorgetOrCreate(int level)Get a cached instance or return a new oneintinitialCompressedBufferLength(int chunkLength)Get initial compressed buffer lengthBufferTypepreferredBufferType()Return the preferred BufferTypejava.util.Set<ICompressor.Uses>recommendedUses()Hints to Cassandra which uses this compressor is recommended for.java.util.Set<java.lang.String>supportedOptions()Lists the supported options by this compressorbooleansupports(BufferType bufferType)Check whether the given BufferType is supportedintuncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)Decompress data using arraysvoiduncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)Decompress data via ByteBuffers
-
-
-
Field Detail
-
FAST_COMPRESSION_LEVEL
public static final int FAST_COMPRESSION_LEVEL
-
BEST_COMPRESSION_LEVEL
public static final int BEST_COMPRESSION_LEVEL
-
DEFAULT_COMPRESSION_LEVEL
public static final int DEFAULT_COMPRESSION_LEVEL
- See Also:
- Constant Field Values
-
COMPRESSION_LEVEL_OPTION_NAME
public static final java.lang.String COMPRESSION_LEVEL_OPTION_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static ZstdCompressor create(java.util.Map<java.lang.String,java.lang.String> options)
Create a Zstd compressor with the given options- Parameters:
options-- Returns:
-
getOrCreate
public static ZstdCompressor getOrCreate(int level)
Get a cached instance or return a new one- Parameters:
level-- Returns:
-
initialCompressedBufferLength
public int initialCompressedBufferLength(int chunkLength)
Get initial compressed buffer length- Specified by:
initialCompressedBufferLengthin interfaceICompressor- Parameters:
chunkLength-- Returns:
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws java.io.IOExceptionDecompress data using arrays- Specified by:
uncompressin interfaceICompressor- Parameters:
input-inputOffset-inputLength-output-outputOffset-- Returns:
- Throws:
java.io.IOException
-
uncompress
public void uncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOExceptionDecompress data via ByteBuffers- Specified by:
uncompressin interfaceICompressor- Parameters:
input-output-- Throws:
java.io.IOException
-
compress
public void compress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOExceptionCompress using ByteBuffers- Specified by:
compressin interfaceICompressor- Parameters:
input-output-- Throws:
java.io.IOException
-
preferredBufferType
public BufferType preferredBufferType()
Return the preferred BufferType- Specified by:
preferredBufferTypein interfaceICompressor- Returns:
-
supports
public boolean supports(BufferType bufferType)
Check whether the given BufferType is supported- Specified by:
supportsin interfaceICompressor- Parameters:
bufferType-- Returns:
-
supportedOptions
public java.util.Set<java.lang.String> supportedOptions()
Lists the supported options by this compressor- Specified by:
supportedOptionsin interfaceICompressor- Returns:
-
getCompressionLevel
public int getCompressionLevel()
-
recommendedUses
public java.util.Set<ICompressor.Uses> recommendedUses()
Description copied from interface:ICompressorHints to Cassandra which uses this compressor is recommended for. For example a compression algorithm which gets good compression ratio may trade off too much compression speed to be useful in certain compression heavy use cases such as flushes or mutation hints. Note that Cassandra may ignore these recommendations, it is not a strict contract.- Specified by:
recommendedUsesin interfaceICompressor
-
-