Class GZipCompressor<T extends Buffer>
java.lang.Object
nom.tam.fits.compression.algorithm.gzip.GZipCompressor<T>
- Type Parameters:
T- The genetic type of element buffer to compress
- All Implemented Interfaces:
ICompressor<T>
- Direct Known Subclasses:
GZip2Compressor,GZipCompressor.ByteGZipCompressor,GZipCompressor.DoubleGZipCompressor,GZipCompressor.FloatGZipCompressor,GZipCompressor.IntGZipCompressor,GZipCompressor.LongGZipCompressor,GZipCompressor.ShortGZipCompressor
(for internal use) The GZIP compression algorithm.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classByte compress is a special case, the only one that does not extends GZipCompress because it can write the buffer directly.static classstatic classstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancompress(T pixelData, ByteBuffer compressed) compress the buffer into the byte buffer.protected GZIPInputStreamcreateGZipInputStream(ByteBuffer compressed) protected GZIPOutputStreamcreateGZipOutputStream(int length, ByteBuffer compressed) voiddecompress(ByteBuffer compressed, T pixelData) Decompress the byte buffer and restore the buffer from it, again enough space must already be allocated.protected abstract voidprotected abstract void
-
Field Details
-
primitiveSize
protected final int primitiveSize -
buffer
protected byte[] buffer -
nioBuffer
-
-
Constructor Details
-
GZipCompressor
public GZipCompressor(int primitiveSize)
-
-
Method Details
-
compress
Description copied from interface:ICompressorcompress the buffer into the byte buffer. Attention enough space must already be allocated.- Specified by:
compressin 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:ICompressorDecompress the byte buffer and restore the buffer from it, again enough space must already be allocated.- Specified by:
decompressin interfaceICompressor<T extends Buffer>- Parameters:
compressed- the compressed datapixelData- the buffer to fill with the uncompressed data.
-
createGZipInputStream
- Throws:
IOException
-
createGZipOutputStream
protected GZIPOutputStream createGZipOutputStream(int length, ByteBuffer compressed) throws IOException - Throws:
IOException
-
getPixel
-
setPixel
-