public class GZipCompression extends Object implements CompressionStrategy
GZipCompression
is a CompressionStrategy implementation using the
GZip library included in the JDK java.util.zip. This is the default
CompressionStrategy used by the CompressionHelper discovery when no other
implementation is discovered.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE |
COMPRESSION_DEFAULT, SERVICE_ID
Constructor and Description |
---|
GZipCompression() |
Modifier and Type | Method and Description |
---|---|
byte[] |
compressByteArray(byte[] bytes)
Used for compressing a byte array into a new byte array using GZIP
|
boolean |
isCompressed(byte[] bytes)
Determines if a byte array is compressed.
|
byte[] |
uncompressByteArray(byte[] bytes)
Used for uncompressing a byte array into a uncompressed byte array using GZIP
|
public static final int DEFAULT_BUFFER_SIZE
public boolean isCompressed(byte[] bytes) throws IOException
isCompressed
in interface CompressionStrategy
bytes
- an array of bytesIOException
- if the byte array couldn't be readpublic byte[] compressByteArray(byte[] bytes) throws IOException
compressByteArray
in interface CompressionStrategy
bytes
- An array of bytes to compressIOException
- if it fails to write to a GZIPOutputStreamGZIPOutputStream
public byte[] uncompressByteArray(byte[] bytes) throws IOException
uncompressByteArray
in interface CompressionStrategy
bytes
- An array of bytes to uncompressIOException
- if it fails to read from a GZIPInputStreamGZIPInputStream
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.