Package org.apache.solr.common.util
Class ZLibCompressor
- java.lang.Object
- 
- org.apache.solr.common.util.ZLibCompressor
 
- 
- All Implemented Interfaces:
- Compressor
 
 public class ZLibCompressor extends Object implements Compressor 
- 
- 
Constructor SummaryConstructors Constructor Description ZLibCompressor()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]compressBytes(byte[] data)Compresses bytes into compressed bytes using the compression implementationbyte[]compressBytes(byte[] data, int initialBufferCapacity)Compresses bytes into compressed bytes using the compression implementationbyte[]decompressBytes(byte[] data)Decompresses compressed bytes, returning the uncompressed data as a byte[]booleanisCompressedBytes(byte[] data)Check to determine if the data is compressed in the expected compression implementation
 
- 
- 
- 
Method Detail- 
isCompressedBytespublic boolean isCompressedBytes(byte[] data) Check to determine if the data is compressed in the expected compression implementationUses the hex magic number for zlib compression '78 01' to check if the bytes are compressed - Specified by:
- isCompressedBytesin interface- Compressor
- Parameters:
- data- - the bytes to check for compression
- Returns:
- true if the data is compressed in the expected compression implementation
 
 - 
decompressBytespublic byte[] decompressBytes(byte[] data) throws ExceptionDescription copied from interface:CompressorDecompresses compressed bytes, returning the uncompressed data as a byte[]- Specified by:
- decompressBytesin interface- Compressor
- Parameters:
- data- the input compressed data to decompress
- Returns:
- the decompressed bytes
- Throws:
- Exception- - The data is not compressed or the data is not compressed in the correct format
 
 - 
compressBytespublic byte[] compressBytes(byte[] data) Description copied from interface:CompressorCompresses bytes into compressed bytes using the compression implementation- Specified by:
- compressBytesin interface- Compressor
- Parameters:
- data- the input uncompressed data to be compressed
- Returns:
- compressed bytes
 
 - 
compressBytespublic byte[] compressBytes(byte[] data, int initialBufferCapacity)Description copied from interface:CompressorCompresses bytes into compressed bytes using the compression implementation- Specified by:
- compressBytesin interface- Compressor
- Parameters:
- data- the input uncompressed data to be compressed
- initialBufferCapacity- the initial capacity of the buffer storing the compressed data. It depends on the data type and the caller may know the expected average compression factor. If this initial capacity is smaller than 16, the buffer capacity will be 16 anyway.
- Returns:
- compressed bytes
 
 
- 
 
-