org.mule.util.compression
Class CompressionHelper

java.lang.Object
  extended byorg.mule.util.compression.CompressionHelper

public class CompressionHelper
extends java.lang.Object

CompressionHelper a static class that provides facilities for compressing and uncompressing byte arrays

Version:
$Revision: 1.2 $
Author:
Ross Mason

Constructor Summary
CompressionHelper()
           
 
Method Summary
static byte[] compressByteArray(byte[] bytes)
          Used for compressing a byte array into a new byte array using the CompressionStategy found using discovery
static CompressionStrategy getCompressionStrategy()
           
static boolean isCompressed(byte[] bytes)
          Determines if a byte array is compressed.
static byte[] uncompressByteArray(byte[] bytes)
          Used for uncompressing a byte array into a uncompressed byte array using the CompressionStategy found using discovery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressionHelper

public CompressionHelper()
Method Detail

getCompressionStrategy

public static final CompressionStrategy getCompressionStrategy()

compressByteArray

public static byte[] compressByteArray(byte[] bytes)
                                throws java.io.IOException
Used for compressing a byte array into a new byte array using the CompressionStategy found using discovery

Parameters:
bytes - An array of bytes to compress
Returns:
a compressed byte array
Throws:
java.io.IOException - if it fails to write to a GZIPOutputStream
See Also:
GZIPOutputStream

uncompressByteArray

public static byte[] uncompressByteArray(byte[] bytes)
                                  throws java.io.IOException
Used for uncompressing a byte array into a uncompressed byte array using the CompressionStategy found using discovery

Parameters:
bytes - An array of bytes to uncompress
Returns:
an uncompressed byte array
Throws:
java.io.IOException - if it fails to read from a InputStream

isCompressed

public static boolean isCompressed(byte[] bytes)
                            throws java.io.IOException
Determines if a byte array is compressed.

Parameters:
bytes - an array of bytes
Returns:
true if the array is compressed or faluse otherwise
Throws:
java.io.IOException - if the byte array couldn't be read


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.