public static enum Compressor.COMPRESSOR_TYPE extends java.lang.Enum<Compressor.COMPRESSOR_TYPE> implements Compressor
Compressor.COMPRESSOR_TYPE
Modifier and Type | Field and Description |
---|---|
Compressor |
compressor |
short |
metadataID |
java.lang.String |
name |
DEFAULT_COMPRESSORDESCRIPTOR
Modifier and Type | Method and Description |
---|---|
Bucket |
compress(Bucket data,
BucketFactory bf,
long maxReadLength,
long maxWriteLength)
Compress the data.
|
long |
compress(java.io.InputStream is,
java.io.OutputStream os,
long maxReadLength,
long maxWriteLength)
Compress the data.
|
long |
compress(java.io.InputStream is,
java.io.OutputStream os,
long maxReadLength,
long maxWriteLength,
long amountOfDataToCheckCompressionRatio,
int minimumCompressionPercentage)
Compress the data (@see
Compressor.compress(InputStream, OutputStream, long, long) ) with checking of compression effect. |
static int |
countCompressors() |
int |
decompress(byte[] dbuf,
int i,
int j,
byte[] output)
Decompress in RAM only.
|
long |
decompress(java.io.InputStream input,
java.io.OutputStream output,
long maxLength,
long maxEstimateSizeLength)
Decompress data.
|
static Compressor.COMPRESSOR_TYPE |
getCompressorByMetadataID(short id) |
static Compressor.COMPRESSOR_TYPE |
getCompressorByName(java.lang.String name) |
static java.lang.String |
getCompressorDescriptor() |
static void |
getCompressorDescriptor(java.lang.StringBuilder sb) |
static Compressor.COMPRESSOR_TYPE[] |
getCompressorsArray(java.lang.String compressordescriptor)
make a COMPRESSOR_TYPE[] from a descriptor string
the descriptor string is a comma separated list of numbers or names(can be mixed) it is better to store the string in db4o instead of the compressors? if the string is null/empty, it returns COMPRESSOR_TYPE.values() as default |
static Compressor.COMPRESSOR_TYPE[] |
getCompressorsArrayNoDefault(java.lang.String compressordescriptor) |
static java.lang.String |
getHelloCompressorDescriptor() |
static Compressor.COMPRESSOR_TYPE |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Compressor.COMPRESSOR_TYPE[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Compressor.COMPRESSOR_TYPE GZIP
public static final Compressor.COMPRESSOR_TYPE BZIP2
public static final Compressor.COMPRESSOR_TYPE LZMA
public static final Compressor.COMPRESSOR_TYPE LZMA_NEW
public final java.lang.String name
public final Compressor compressor
public final short metadataID
public static Compressor.COMPRESSOR_TYPE[] values()
for (Compressor.COMPRESSOR_TYPE c : Compressor.COMPRESSOR_TYPE.values()) System.out.println(c);
public static Compressor.COMPRESSOR_TYPE valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static Compressor.COMPRESSOR_TYPE getCompressorByMetadataID(short id)
public static Compressor.COMPRESSOR_TYPE getCompressorByName(java.lang.String name)
public static java.lang.String getHelloCompressorDescriptor()
public static java.lang.String getCompressorDescriptor()
public static void getCompressorDescriptor(java.lang.StringBuilder sb)
public static Compressor.COMPRESSOR_TYPE[] getCompressorsArray(java.lang.String compressordescriptor) throws InvalidCompressionCodecException
compressordescriptor
- InvalidCompressionCodecException
public static Compressor.COMPRESSOR_TYPE[] getCompressorsArrayNoDefault(java.lang.String compressordescriptor) throws InvalidCompressionCodecException
InvalidCompressionCodecException
public Bucket compress(Bucket data, BucketFactory bf, long maxReadLength, long maxWriteLength) throws java.io.IOException, CompressionOutputSizeException
Compressor
compress
in interface Compressor
data
- The bucket to read from.bf
- The means to create a new bucket.maxReadLength
- The maximum number of bytes to read from the input bucket.maxWriteLength
- The maximum number of bytes to write to the output bucket. If this is exceeded, throw a CompressionOutputSizeException.java.io.IOException
- If an error occurs reading or writing data.CompressionOutputSizeException
- If the compressed data is larger than maxWriteLength.public long compress(java.io.InputStream is, java.io.OutputStream os, long maxReadLength, long maxWriteLength) throws java.io.IOException, CompressionOutputSizeException
Compressor
compress
in interface Compressor
is
- The InputStream to read from.os
- The OutputStream to write to.maxReadLength
- The maximum number of bytes to read from the input bucket.maxWriteLength
- The maximum number of bytes to write to the output bucket. If this is exceeded, throw a CompressionOutputSizeException.java.io.IOException
- If an error occurs reading or writing data.CompressionOutputSizeException
- If the compressed data is larger than maxWriteLength.public long compress(java.io.InputStream is, java.io.OutputStream os, long maxReadLength, long maxWriteLength, long amountOfDataToCheckCompressionRatio, int minimumCompressionPercentage) throws java.io.IOException, CompressionRatioException
Compressor
Compressor.compress(InputStream, OutputStream, long, long)
) with checking of compression effect.compress
in interface Compressor
amountOfDataToCheckCompressionRatio
- The data amount after compression of which we will check whether we have got the desired effect.minimumCompressionPercentage
- The minimal desired compression effect, %. A value of 0 means that the
compression effect will not be checked.CompressionRatioException
- If the desired compression effect is not achieved.java.io.IOException
public long decompress(java.io.InputStream input, java.io.OutputStream output, long maxLength, long maxEstimateSizeLength) throws java.io.IOException, CompressionOutputSizeException
Compressor
decompress
in interface Compressor
input
- Where to read the data to decompress fromoutput
- Where to write the final product tomaxLength
- The maximum length to decompress (we throw if more is present).maxEstimateSizeLength
- If the data is too big, and this is >0, read up to this many bytes in order to try to get the data size.java.io.IOException
CompressionOutputSizeException
public int decompress(byte[] dbuf, int i, int j, byte[] output) throws CompressionOutputSizeException
Compressor
decompress
in interface Compressor
dbuf
- Input buffer.i
- Offset to start reading from.j
- Number of bytes to read.output
- Output buffer.CompressionOutputSizeException
public static int countCompressors()