Package org.apache.iotdb.tsfile.compress
Interface ICompressor
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
ICompressor.GZIPCompressor,ICompressor.IOTDBLZ4Compressor,ICompressor.LZMA2Compressor,ICompressor.NoCompressor,ICompressor.SnappyCompressor,ICompressor.ZstdCompressor
public interface ICompressor extends java.io.Serializablecompress data according to type in schema.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classICompressor.GZIPCompressstatic classICompressor.GZIPCompressorstatic classICompressor.IOTDBLZ4Compressorstatic classICompressor.LZMA2Compressstatic classICompressor.LZMA2Compressorstatic classICompressor.NoCompressorNoCompressor will do nothing for data and return the input data directly.static classICompressor.SnappyCompressorstatic classICompressor.ZstdCompressor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]compress(byte[] data)byte[]compress(byte[] data, int offset, int length)abstract method of compress.intcompress(byte[] data, int offset, int length, byte[] compressed)abstract method of compress.intcompress(java.nio.ByteBuffer data, java.nio.ByteBuffer compressed)If the data is large, this function is better than byte[].static ICompressorgetCompressor(java.lang.String name)static ICompressorgetCompressor(CompressionType name)get Compressor according to CompressionType.intgetMaxBytesForCompression(int uncompressedDataSize)Get the maximum byte size needed for compressing data of the given byte size.CompressionTypegetType()
-
-
-
Method Detail
-
getCompressor
static ICompressor getCompressor(java.lang.String name)
-
getCompressor
static ICompressor getCompressor(CompressionType name)
get Compressor according to CompressionType.- Parameters:
name- CompressionType- Returns:
- the Compressor of specified CompressionType
-
compress
byte[] compress(byte[] data) throws java.io.IOException- Throws:
java.io.IOException
-
compress
byte[] compress(byte[] data, int offset, int length) throws java.io.IOExceptionabstract method of compress. this method has an important overhead due to the fact that it needs to allocate a byte array to compress into, and then needs to resize this buffer to the actual compressed length.- Returns:
- byte array of compressed data.
- Throws:
java.io.IOException
-
compress
int compress(byte[] data, int offset, int length, byte[] compressed) throws java.io.IOExceptionabstract method of compress.- Returns:
- byte length of compressed data.
- Throws:
java.io.IOException
-
compress
int compress(java.nio.ByteBuffer data, java.nio.ByteBuffer compressed) throws java.io.IOExceptionIf the data is large, this function is better than byte[].- Parameters:
data- MUST be DirectByteBuffer for Snappy.compressed- MUST be DirectByteBuffer for Snappy.- Returns:
- byte length of compressed data.
- Throws:
java.io.IOException
-
getMaxBytesForCompression
int getMaxBytesForCompression(int uncompressedDataSize)
Get the maximum byte size needed for compressing data of the given byte size. For GZIP, this method is insecure and may causeGZIPCompressOverflowException- Parameters:
uncompressedDataSize- byte size of the data to compress- Returns:
- maximum byte size of the compressed data
-
getType
CompressionType getType()
-
-