Package org.apache.cassandra.io.compress
Interface ICompressor
- All Known Implementing Classes:
DeflateCompressor,LZ4Compressor,NoopCompressor,SnappyCompressor,ZstdCompressor
public interface ICompressor
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumWays that a particular instance of ICompressor should be used internally in Cassandra. -
Method Summary
Modifier and TypeMethodDescriptionvoidcompress(ByteBuffer input, ByteBuffer output) Compression for ByteBuffers.intinitialCompressedBufferLength(int chunkLength) Returns the preferred (most efficient) buffer type for this compressor.default Set<ICompressor.Uses>Hints to Cassandra which uses this compressor is recommended for.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(ByteBuffer input, ByteBuffer output) Decompression for DirectByteBuffers.
-
Method Details
-
initialCompressedBufferLength
int initialCompressedBufferLength(int chunkLength) -
uncompress
int uncompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException - Throws:
IOException
-
compress
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.- Throws:
IOException
-
uncompress
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.- Throws:
IOException
-
preferredBufferType
BufferType preferredBufferType()Returns the preferred (most efficient) buffer type for this compressor. -
supports
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. -
supportedOptions
-
recommendedUses
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.
-