Class GZipCompressor<T extends java.nio.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
public abstract class GZipCompressor<T extends java.nio.Buffer> extends java.lang.Object implements ICompressor<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GZipCompressor.ByteGZipCompressor
Byte compress is a special case, the only one that does not extends GZipCompress because it can write the buffer directly.static class
GZipCompressor.DoubleGZipCompressor
static class
GZipCompressor.FloatGZipCompressor
static class
GZipCompressor.IntGZipCompressor
static class
GZipCompressor.LongGZipCompressor
static class
GZipCompressor.ShortGZipCompressor
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
buffer
protected T
nioBuffer
protected int
primitiveSize
-
Constructor Summary
Constructors Constructor Description GZipCompressor(int primitiveSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
compress(T pixelData, java.nio.ByteBuffer compressed)
compress the buffer into the byte buffer.protected java.util.zip.GZIPInputStream
createGZipInputStream(java.nio.ByteBuffer compressed)
protected java.util.zip.GZIPOutputStream
createGZipOutputStream(int length, java.nio.ByteBuffer compressed)
void
decompress(java.nio.ByteBuffer compressed, T pixelData)
Decompress the byte buffer and restore the buffer from it, again enough space must already be allocated.protected abstract void
getPixel(T pixelData, byte[] pixelBytes)
protected abstract void
setPixel(T pixelData, byte[] pixelBytes)
-
-
-
Field Detail
-
primitiveSize
protected final int primitiveSize
-
buffer
protected byte[] buffer
-
nioBuffer
protected T extends java.nio.Buffer nioBuffer
-
-
Method Detail
-
compress
public boolean compress(T pixelData, java.nio.ByteBuffer compressed)
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 java.nio.Buffer>
- Parameters:
pixelData
- the buffer to compress.compressed
- the compressed data- Returns:
- true if the compression succeeded.
-
decompress
public void decompress(java.nio.ByteBuffer compressed, T pixelData)
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 java.nio.Buffer>
- Parameters:
compressed
- the compressed datapixelData
- the buffer to fill with the uncompressed data.
-
createGZipInputStream
protected java.util.zip.GZIPInputStream createGZipInputStream(java.nio.ByteBuffer compressed) throws java.io.IOException
- Throws:
java.io.IOException
-
createGZipOutputStream
protected java.util.zip.GZIPOutputStream createGZipOutputStream(int length, java.nio.ByteBuffer compressed) throws java.io.IOException
- Throws:
java.io.IOException
-
getPixel
protected abstract void getPixel(T pixelData, byte[] pixelBytes)
-
setPixel
protected abstract void setPixel(T pixelData, byte[] pixelBytes)
-
-