java.lang.Object | |
↳ | com.microstrategy.utils.GZIPHelper |
GZIPHelper is a utility class to compress/decompress data using GZIP alorithm (aka LZ77 algorithm). It also provide functions to encode the result of compression into a String or decode it into a byte array using Base64 algorithm.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ESTIMATE_XML_STATUS_COMPRESS_RATIO | The estimate compress ratio for XML status. | |||||||||
int | ESTIMATE_XML_STATUS_COMPRESS_RATIO_DELTA | The estimate variation value of the compression ration. | |||||||||
String | MAGIC_HEADER | The magic header for Ziped and Base64ed string. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GZIPHelper() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String |
base64AndDecompress(String fromString, int estimateRatio)
De-transform a String data using Base64 algorithm and then de-compress the result into another String.
| ||||||||||
void |
compress(OutputStream toStream, String fromString, int estimateRatio)
Compress data from a String to an OutputStream.
| ||||||||||
byte[] |
compress(String fromString, int estimateRatio)
Compress data from an String and returns a byte array for the result.
| ||||||||||
String |
compressAndBase64(String fromString, int estimateRatio)
Compress a String data and then transform the result into another String using Base64 algorithm.
| ||||||||||
String |
decompress(InputStream fromStream, int bufferSize)
De-compress data from an InputStream and returns the result as a String.
| ||||||||||
String |
decompress(byte[] fromData, int estimateRatio)
De-compress a byte array of data and returns the result as a String.
| ||||||||||
static GZIPHelper |
getInstance()
Sigleton entry.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The estimate compress ratio for XML status.
The estimate variation value of the compression ration.
The magic header for Ziped and Base64ed string.
De-transform a String data using Base64 algorithm and then de-compress the result into another String.
It is the reverse process of compressAndBase64(String, int)
method.
fromString | The String data to be transformed and de-compressed. |
---|---|
estimateRatio | The estimated ratio of the compression operation. |
Compress data from a String to an OutputStream.
toStream | The target OutputStream. |
---|---|
fromString | The String data to be compressed. |
estimateRatio | The estimated ratio of this compression operation. |
Compress data from an String and returns a byte array for the result.
fromString | The String data to be compressed. |
---|---|
estimateRatio | The estimated ratio of this compression operation. |
Compress a String data and then transform the result into another String using Base64 algorithm.
fromString | The String data to be compressed and transformed. |
---|---|
estimateRatio | The estimated ratio of the compression operation. |
De-compress data from an InputStream and returns the result as a String.
fromStream | The InputStream to be de-compressed. |
---|---|
bufferSize | The estimate size of the StringBuffer to be allocated to hold the result. |
De-compress a byte array of data and returns the result as a String.
fromData | The byte array of data to be de-compressed. |
---|---|
estimateRatio | The estimated ratio of the compression operation. |