Package org.apache.cassandra.io.compress
Class LZ4Compressor
- java.lang.Object
-
- org.apache.cassandra.io.compress.LZ4Compressor
-
- All Implemented Interfaces:
ICompressor
public class LZ4Compressor extends java.lang.Object implements ICompressor
-
-
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 java.lang.StringLZ4_COMPRESSOR_TYPEstatic java.lang.StringLZ4_FAST_COMPRESSORstatic java.lang.StringLZ4_HIGH_COMPRESSION_LEVELstatic java.lang.StringLZ4_HIGH_COMPRESSOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)Compression for ByteBuffers.static LZ4Compressorcreate(java.util.Map<java.lang.String,java.lang.String> args)intinitialCompressedBufferLength(int chunkLength)BufferTypepreferredBufferType()Returns the preferred (most efficient) buffer type for this compressor.java.util.Set<ICompressor.Uses>recommendedUses()Hints to Cassandra which uses this compressor is recommended for.java.util.Set<java.lang.String>supportedOptions()booleansupports(BufferType bufferType)Checks if the given buffer would be supported by the compressor.intuncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)voiduncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)Decompression for DirectByteBuffers.static java.lang.IntegervalidateCompressionLevel(java.lang.String compressionLevel)static java.lang.StringvalidateCompressorType(java.lang.String compressorType)
-
-
-
Field Detail
-
LZ4_FAST_COMPRESSOR
public static final java.lang.String LZ4_FAST_COMPRESSOR
- See Also:
- Constant Field Values
-
LZ4_HIGH_COMPRESSOR
public static final java.lang.String LZ4_HIGH_COMPRESSOR
- See Also:
- Constant Field Values
-
LZ4_HIGH_COMPRESSION_LEVEL
public static final java.lang.String LZ4_HIGH_COMPRESSION_LEVEL
- See Also:
- Constant Field Values
-
LZ4_COMPRESSOR_TYPE
public static final java.lang.String LZ4_COMPRESSOR_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static LZ4Compressor create(java.util.Map<java.lang.String,java.lang.String> args) throws ConfigurationException
- Throws:
ConfigurationException
-
initialCompressedBufferLength
public int initialCompressedBufferLength(int chunkLength)
- Specified by:
initialCompressedBufferLengthin interfaceICompressor
-
compress
public void compress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOExceptionDescription copied from interface:ICompressorCompression for ByteBuffers. The data between input.position() and input.limit() is compressed and placed into output starting from output.position(). Positions in both buffers are moved to reflect the bytes read and written. Limits are not changed.- Specified by:
compressin interfaceICompressor- Throws:
java.io.IOException
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws java.io.IOException- Specified by:
uncompressin interfaceICompressor- Throws:
java.io.IOException
-
uncompress
public void uncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOExceptionDescription copied from interface:ICompressorDecompression for DirectByteBuffers. The data between input.position() and input.limit() is uncompressed and placed into output starting from output.position(). Positions in both buffers are moved to reflect the bytes read and written. Limits are not changed.- Specified by:
uncompressin interfaceICompressor- Throws:
java.io.IOException
-
supportedOptions
public java.util.Set<java.lang.String> supportedOptions()
- Specified by:
supportedOptionsin interfaceICompressor
-
validateCompressorType
public static java.lang.String validateCompressorType(java.lang.String compressorType) throws ConfigurationException- Throws:
ConfigurationException
-
validateCompressionLevel
public static java.lang.Integer validateCompressionLevel(java.lang.String compressionLevel) throws ConfigurationException- Throws:
ConfigurationException
-
preferredBufferType
public BufferType preferredBufferType()
Description copied from interface:ICompressorReturns the preferred (most efficient) buffer type for this compressor.- Specified by:
preferredBufferTypein interfaceICompressor
-
supports
public boolean supports(BufferType bufferType)
Description copied from interface:ICompressorChecks if the given buffer would be supported by the compressor. If a type is supported, the compressor must be able to use it in combination with all other supported types. Direct and memory-mapped buffers must be supported by all compressors.- Specified by:
supportsin interfaceICompressor
-
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
-
-