public class CompressTool extends Object
Modifier and Type | Method and Description |
---|---|
byte[] |
compress(byte[] in,
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 int |
getCompressAlgorithm(String algorithm)
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 InputStream |
wrapInputStream(InputStream in,
String compressionAlgorithm,
String entryName)
INTERNAL
|
static OutputStream |
wrapOutputStream(OutputStream out,
String compressionAlgorithm,
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, 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)
public 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 int getCompressAlgorithm(String algorithm)
public static OutputStream wrapOutputStream(OutputStream out, String compressionAlgorithm, String entryName)
public static InputStream wrapInputStream(InputStream in, String compressionAlgorithm, String entryName)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.