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 int
BEST_COMPRESSION_LEVEL
static java.lang.String
COMPRESSION_LEVEL_OPTION_NAME
static int
DEFAULT_COMPRESSION_LEVEL
static int
FAST_COMPRESSION_LEVEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
Compress using ByteBuffersstatic ZstdCompressor
create(java.util.Map<java.lang.String,java.lang.String> options)
Create a Zstd compressor with the given optionsint
getCompressionLevel()
static ZstdCompressor
getOrCreate(int level)
Get a cached instance or return a new oneint
initialCompressedBufferLength(int chunkLength)
Get initial compressed buffer lengthBufferType
preferredBufferType()
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 compressorboolean
supports(BufferType bufferType)
Check whether the given BufferType is supportedint
uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
Decompress data using arraysvoid
uncompress(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:
initialCompressedBufferLength
in interfaceICompressor
- Parameters:
chunkLength
-- Returns:
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws java.io.IOException
Decompress data using arrays- Specified by:
uncompress
in 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.IOException
Decompress data via ByteBuffers- Specified by:
uncompress
in interfaceICompressor
- Parameters:
input
-output
-- Throws:
java.io.IOException
-
compress
public void compress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOException
Compress using ByteBuffers- Specified by:
compress
in interfaceICompressor
- Parameters:
input
-output
-- Throws:
java.io.IOException
-
preferredBufferType
public BufferType preferredBufferType()
Return the preferred BufferType- Specified by:
preferredBufferType
in interfaceICompressor
- Returns:
-
supports
public boolean supports(BufferType bufferType)
Check whether the given BufferType is supported- Specified by:
supports
in interfaceICompressor
- Parameters:
bufferType
-- Returns:
-
supportedOptions
public java.util.Set<java.lang.String> supportedOptions()
Lists the supported options by this compressor- Specified by:
supportedOptions
in interfaceICompressor
- Returns:
-
getCompressionLevel
public int getCompressionLevel()
-
recommendedUses
public java.util.Set<ICompressor.Uses> recommendedUses()
Description copied from interface:ICompressor
Hints 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:
recommendedUses
in interfaceICompressor
-
-