Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mule.util.compression
Class GZipCompression  view GZipCompression download GZipCompression.java

java.lang.Object
  extended byorg.mule.util.compression.GZipCompression
All Implemented Interfaces:
CompressionStrategy

public class GZipCompression
extends java.lang.Object
implements CompressionStrategy

GZipCompression 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

Version:
$Revision: 1.4 $

Field Summary
private static org.apache.commons.logging.Log log
          The logger for this class
 
Fields inherited from interface org.mule.util.compression.CompressionStrategy
COMPRESSION_DEFAULT, SERVICE_ID
 
Constructor Summary
GZipCompression()
           
 
Method Summary
 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.
private  int readByte(java.io.InputStream in)
           
 byte[] uncompressByteArray(byte[] bytes)
          Used for uncompressing a byte array into a uncompressed byte array using GZIP
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final transient org.apache.commons.logging.Log log
The logger for this class

Constructor Detail

GZipCompression

public GZipCompression()
Method Detail

isCompressed

public boolean isCompressed(byte[] bytes)
                     throws java.io.IOException
Determines if a byte array is compressed. The java.util.zip GZip implementaiton does not expose the GZip header so it is difficult to determine if a string is compressed.

Specified by:
isCompressed in interface CompressionStrategy

readByte

private int readByte(java.io.InputStream in)
              throws java.io.IOException

compressByteArray

public byte[] compressByteArray(byte[] bytes)
                         throws java.io.IOException
Used for compressing a byte array into a new byte array using GZIP

Specified by:
compressByteArray in interface CompressionStrategy

uncompressByteArray

public byte[] uncompressByteArray(byte[] bytes)
                           throws java.io.IOException
Used for uncompressing a byte array into a uncompressed byte array using GZIP

Specified by:
uncompressByteArray in interface CompressionStrategy