Class GZipCompressor<T extends Buffer>
java.lang.Object
nom.tam.fits.compression.algorithm.gzip.GZipCompressor<T>
- All Implemented Interfaces:
ICompressor<T>
- Direct Known Subclasses:
GZip2Compressor
,GZipCompressor.ByteGZipCompressor
,GZipCompressor.DoubleGZipCompressor
,GZipCompressor.FloatGZipCompressor
,GZipCompressor.IntGZipCompressor
,GZipCompressor.LongGZipCompressor
,GZipCompressor.ShortGZipCompressor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Byte compress is a special case, the only one that does not extends GZipCompress because it can write the buffer directly.static class
static class
static class
static class
static class
private final class
GZipCompressor.TypeConversion<B extends Buffer>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
compress
(T pixelData, ByteBuffer compressed) compress the buffer into the byte buffer.protected GZIPInputStream
createGZipInputStream
(ByteBuffer compressed) protected GZIPOutputStream
createGZipOutputStream
(int length, ByteBuffer compressed) void
decompress
(ByteBuffer compressed, T pixelData) Decompress the byte buffer and restore the buffer from it, again enough space must already be allocated.protected abstract void
private <B extends Buffer>
PrimitiveType<B> getPrimitiveType
(int size) private GZipCompressor<T>.TypeConversion
<Buffer> getTypeConverter
(ByteBuffer compressed, int nrOfPrimitiveElements) protected abstract void
-
Field Details
-
DEFAULT_GZIP_BUFFER_SIZE
private static final int DEFAULT_GZIP_BUFFER_SIZE- See Also:
-
MINIMAL_GZIP_BUFFER_SIZE
private static final int MINIMAL_GZIP_BUFFER_SIZE- See Also:
-
primitiveSize
protected final int primitiveSize -
buffer
protected byte[] buffer -
nioBuffer
-
sizeArray
private final byte[] sizeArray -
sizeBuffer
-
-
Constructor Details
-
GZipCompressor
public GZipCompressor(int primitiveSize)
-
-
Method Details
-
compress
Description copied from interface:ICompressor
compress the buffer into the byte buffer. Attention enough space must already be allocated.- Specified by:
compress
in interfaceICompressor<T extends Buffer>
- Parameters:
pixelData
- the buffer to compress.compressed
- the compressed data- Returns:
- true if the compression succeeded.
-
decompress
Description copied from interface:ICompressor
Decompress the byte buffer and restore the buffer from it, again enough space must already be allocated.- Specified by:
decompress
in interfaceICompressor<T extends Buffer>
- Parameters:
compressed
- the compressed datapixelData
- the buffer to fill with the uncompressed data.
-
getPrimitiveType
-
getTypeConverter
private GZipCompressor<T>.TypeConversion<Buffer> getTypeConverter(ByteBuffer compressed, int nrOfPrimitiveElements) -
createGZipInputStream
- Throws:
IOException
-
createGZipOutputStream
protected GZIPOutputStream createGZipOutputStream(int length, ByteBuffer compressed) throws IOException - Throws:
IOException
-
getPixel
-
setPixel
-