public class CompressTool
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
byte[] |
compress(byte[] in,
java.lang.String algorithm)
Compressed the data using the specified algorithm.
|
byte[] |
expand(byte[] in)
Expands the compressed data.
|
static void |
expand(byte[] in,
byte[] out,
int outPos)
INTERNAL
|
static CompressTool |
getInstance()
Get a new instance.
|
static int |
getVariableIntLength(int x)
Get a variable size integer length using Rice coding.
|
static int |
readVariableInt(byte[] buff,
int pos)
Read a variable size integer using Rice coding.
|
static java.io.InputStream |
wrapInputStream(java.io.InputStream in,
java.lang.String compressionAlgorithm,
java.lang.String entryName)
INTERNAL
|
static java.io.OutputStream |
wrapOutputStream(java.io.OutputStream out,
java.lang.String compressionAlgorithm,
java.lang.String entryName)
INTERNAL
|
static int |
writeVariableInt(byte[] buff,
int pos,
int x)
Write a variable size integer using Rice coding.
|
public static CompressTool getInstance()
public byte[] compress(byte[] in, java.lang.String algorithm)
in
- the byte array with the original dataalgorithm
- the algorithm (LZF, DEFLATE)public byte[] expand(byte[] in)
in
- the byte array with the compressed datapublic static void expand(byte[] in, byte[] out, int outPos)
in
- compressed dataout
- uncompressed resultoutPos
- the offset at the output arraypublic static int readVariableInt(byte[] buff, int pos)
buff
- the bufferpos
- the positionpublic static int writeVariableInt(byte[] buff, int pos, int x)
buff
- the bufferpos
- the positionx
- the valuepublic static int getVariableIntLength(int x)
x
- the valuepublic static java.io.OutputStream wrapOutputStream(java.io.OutputStream out, java.lang.String compressionAlgorithm, java.lang.String entryName)
out
- streamcompressionAlgorithm
- to be usedentryName
- in a zip filepublic static java.io.InputStream wrapInputStream(java.io.InputStream in, java.lang.String compressionAlgorithm, java.lang.String entryName)
in
- streamcompressionAlgorithm
- to be usedentryName
- in a zip file