Package org.apache.cassandra.io.compress
Class DeflateCompressor
- java.lang.Object
-
- org.apache.cassandra.io.compress.DeflateCompressor
-
- All Implemented Interfaces:
ICompressor
public class DeflateCompressor 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 DeflateCompressor
instance
-
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)
Compression for ByteBuffers.int
compressArray(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength)
void
compressBuffer(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
static DeflateCompressor
create(java.util.Map<java.lang.String,java.lang.String> compressionOptions)
static byte[]
getThreadLocalScratchBuffer()
int
initialCompressedBufferLength(int sourceLen)
BufferType
preferredBufferType()
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()
boolean
supports(BufferType bufferType)
Checks if the given buffer would be supported by the compressor.int
uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
int
uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength)
void
uncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
Decompression for DirectByteBuffers.void
uncompressBuffer(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
-
-
-
Field Detail
-
instance
public static final DeflateCompressor instance
-
-
Method Detail
-
getThreadLocalScratchBuffer
public static byte[] getThreadLocalScratchBuffer()
-
create
public static DeflateCompressor create(java.util.Map<java.lang.String,java.lang.String> compressionOptions)
-
supportedOptions
public java.util.Set<java.lang.String> supportedOptions()
- Specified by:
supportedOptions
in interfaceICompressor
-
initialCompressedBufferLength
public int initialCompressedBufferLength(int sourceLen)
- Specified by:
initialCompressedBufferLength
in interfaceICompressor
-
compress
public void compress(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
Description copied from interface:ICompressor
Compression 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:
compress
in interfaceICompressor
-
compressArray
public int compressArray(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength)
-
compressBuffer
public void compressBuffer(java.nio.ByteBuffer input, java.nio.ByteBuffer output)
-
uncompress
public void uncompress(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOException
Description copied from interface:ICompressor
Decompression 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:
uncompress
in interfaceICompressor
- Throws:
java.io.IOException
-
uncompressBuffer
public void uncompressBuffer(java.nio.ByteBuffer input, java.nio.ByteBuffer output) throws java.io.IOException
- Throws:
java.io.IOException
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws java.io.IOException
- Specified by:
uncompress
in interfaceICompressor
- Throws:
java.io.IOException
-
uncompress
public int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) throws java.io.IOException
- Throws:
java.io.IOException
-
supports
public boolean supports(BufferType bufferType)
Description copied from interface:ICompressor
Checks 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:
supports
in interfaceICompressor
-
preferredBufferType
public BufferType preferredBufferType()
Description copied from interface:ICompressor
Returns the preferred (most efficient) buffer type for this compressor.- Specified by:
preferredBufferType
in interfaceICompressor
-
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
-
-