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 Summary
Constructors Constructor Description ZLibCompressor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
compressBytes(byte[] data)
Compresses bytes into compressed bytes using the compression implementationbyte[]
decompressBytes(byte[] data)
Decompresses compressed bytes, returning the uncompressed data as a byte[]boolean
isCompressedBytes(byte[] data)
Check to determine if the data is compressed in the expected compression implementation
-
-
-
Method Detail
-
isCompressedBytes
public 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:
isCompressedBytes
in interfaceCompressor
- Parameters:
data
- - the bytes to check for compression- Returns:
- true if the data is compressed in the expected compression implementation
-
decompressBytes
public byte[] decompressBytes(byte[] data) throws Exception
Description copied from interface:Compressor
Decompresses compressed bytes, returning the uncompressed data as a byte[]- Specified by:
decompressBytes
in interfaceCompressor
- 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
-
compressBytes
public byte[] compressBytes(byte[] data)
Description copied from interface:Compressor
Compresses bytes into compressed bytes using the compression implementation- Specified by:
compressBytes
in interfaceCompressor
- Parameters:
data
- the input uncompressed data to be compressed- Returns:
- compressed bytes
-
-