org.osesb.utilities.compression
Class ZIPCompressionService

java.lang.Object
  extended by org.osesb.utilities.compression.ZIPCompressionService
All Implemented Interfaces:
ICompressionService

public class ZIPCompressionService
extends java.lang.Object
implements ICompressionService

This Class implements ICompressionService interface using the java.util.zip classes.


Field Summary
protected static org.apache.commons.logging.Log log
          The logging implementation for this class.
protected  java.lang.String thisClassName
          The full name of this class.
 
Constructor Summary
ZIPCompressionService()
          Creates a new instance of ZIPCompressionService.
 
Method Summary
 byte[] compress(byte[] originalData)
          Compress input data.
 byte[] compress(java.io.InputStream originalData)
          Compress input data.
 byte[] decompress(byte[] compressedData)
          Decompress input data.
 byte[] decompress(java.io.InputStream compressedData)
          Decompress input data.
static void main(java.lang.String[] args)
          main() - For Testing and sandboxing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
The logging implementation for this class.


thisClassName

protected java.lang.String thisClassName
The full name of this class.

Constructor Detail

ZIPCompressionService

public ZIPCompressionService()
Creates a new instance of ZIPCompressionService.

Method Detail

compress

public byte[] compress(byte[] originalData)
                throws java.lang.Exception
Compress input data.

Specified by:
compress in interface ICompressionService
Parameters:
originalData - The data to compress as a byte[].
Returns:
the compressed data as a byte[].
Throws:
java.lang.Exception - if there is a problem compressing the data.

compress

public byte[] compress(java.io.InputStream originalData)
                throws java.lang.Exception
Compress input data.

Specified by:
compress in interface ICompressionService
Parameters:
originalData - The data to compress as a InputStream.
Returns:
the compressed data as a byte[].
Throws:
java.lang.Exception - if there is a problem compressing the data.

decompress

public byte[] decompress(byte[] compressedData)
                  throws java.lang.Exception
Decompress input data.

Specified by:
decompress in interface ICompressionService
Parameters:
compressedData - The data to decompress as a byte[].
Returns:
the decompressed data as a byte[].
Throws:
java.lang.Exception - if there is a problem decompressing the data.

decompress

public byte[] decompress(java.io.InputStream compressedData)
                  throws java.lang.Exception
Decompress input data.

Specified by:
decompress in interface ICompressionService
Parameters:
compressedData - The data to decompress as an InputStream.
Returns:
the decompressed data as a byte[].
Throws:
java.lang.Exception - if there is a problem decompressing the data.

main

public static void main(java.lang.String[] args)
main() - For Testing and sandboxing.