Package org.apache.iotdb.tsfile.compress
Class ICompressor.GZIPCompressor
- java.lang.Object
-
- org.apache.iotdb.tsfile.compress.ICompressor.GZIPCompressor
-
- All Implemented Interfaces:
java.io.Serializable,ICompressor
- Enclosing interface:
- ICompressor
public static class ICompressor.GZIPCompressor extends java.lang.Object implements ICompressor
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.iotdb.tsfile.compress.ICompressor
ICompressor.GZIPCompress, ICompressor.GZIPCompressor, ICompressor.IOTDBLZ4Compressor, ICompressor.LZMA2Compress, ICompressor.LZMA2Compressor, ICompressor.NoCompressor, ICompressor.SnappyCompressor, ICompressor.ZstdCompressor
-
-
Constructor Summary
Constructors Constructor Description GZIPCompressor()
-
Method Summary
All Methods Instance Methods Concrete 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[].intgetMaxBytesForCompression(int uncompressedDataSize)Get the maximum byte size needed for compressing data of the given byte size.CompressionTypegetType()
-
-
-
Method Detail
-
compress
public byte[] compress(byte[] data) throws java.io.IOException- Specified by:
compressin interfaceICompressor- Throws:
java.io.IOException
-
compress
public byte[] compress(byte[] data, int offset, int length) throws java.io.IOExceptionDescription copied from interface:ICompressorabstract 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.- Specified by:
compressin interfaceICompressor- Returns:
- byte array of compressed data.
- Throws:
java.io.IOException
-
compress
public int compress(byte[] data, int offset, int length, byte[] compressed) throws java.io.IOExceptionDescription copied from interface:ICompressorabstract method of compress.- Specified by:
compressin interfaceICompressor- Returns:
- byte length of compressed data.
- Throws:
GZIPCompressOverflowException- if compressed byte array is too small.java.io.IOException
-
compress
public int compress(java.nio.ByteBuffer data, java.nio.ByteBuffer compressed) throws java.io.IOExceptionDescription copied from interface:ICompressorIf the data is large, this function is better than byte[].- Specified by:
compressin interfaceICompressor- Parameters:
data- MUST be DirectByteBuffer for Snappy.compressed- MUST be DirectByteBuffer for Snappy.- Returns:
- byte length of compressed data.
- Throws:
GZIPCompressOverflowException- if compressed ByteBuffer is too small.java.io.IOException
-
getMaxBytesForCompression
public int getMaxBytesForCompression(int uncompressedDataSize)
Description copied from interface:ICompressorGet the maximum byte size needed for compressing data of the given byte size. For GZIP, this method is insecure and may causeGZIPCompressOverflowException- Specified by:
getMaxBytesForCompressionin interfaceICompressor- Parameters:
uncompressedDataSize- byte size of the data to compress- Returns:
- maximum byte size of the compressed data
-
getType
public CompressionType getType()
- Specified by:
getTypein interfaceICompressor
-
-