ariba.util.core
Class GZipUtil

java.lang.Object
  extended by ariba.util.core.GZipUtil

public abstract class GZipUtil
extends java.lang.Object

Utility class to perform gzip on strings, byte arrays, etc.


Constructor Summary
GZipUtil()
           
 
Method Summary
static byte[] compress(byte[] value)
          Compresses the byte array given using GZIP.
static byte[] compress(java.lang.String value)
          Compresses the string value into an array of bytes.
static byte[] decompress(byte[] bytes)
          Decompresses an array of bytes.
static java.io.InputStream getInputStream(byte[] data)
          Returns input stream to decompress the data as read.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZipUtil

public GZipUtil()
Method Detail

compress

public static byte[] compress(java.lang.String value)
                       throws java.lang.RuntimeException
Compresses the string value into an array of bytes.

Parameters:
value - - the string value to compress
Returns:
byte[] - the array of bytes containing the compressed value.
Throws:
java.lang.RuntimeException - - if there is a decompression issue (rare).

compress

public static byte[] compress(byte[] value)
                       throws java.lang.RuntimeException
Compresses the byte array given using GZIP.

Parameters:
value - - the uncompressed data
Returns:
the compressed bytes. if the input is null or zero length, the input is returned.
Throws:
java.lang.RuntimeException - - if there is a problem.

decompress

public static byte[] decompress(byte[] bytes)
                         throws java.lang.RuntimeException
Decompresses an array of bytes.

Parameters:
bytes - - the compressed bytes to decompress.
Returns:
byte[] - the array of bytes containing the decompressed value.
Throws:
java.lang.RuntimeException - - if there is a decompression issue (rare).

getInputStream

public static java.io.InputStream getInputStream(byte[] data)
                                          throws java.io.IOException
Returns input stream to decompress the data as read.

Parameters:
data - the compressed bytes
Returns:
InputStream, never null.
Throws:
java.io.IOException


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.