Package nom.tam.fits.compress
Class CompressionManager
- java.lang.Object
-
- nom.tam.fits.compress.CompressionManager
-
public final class CompressionManager extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
BZIP2_EXTENTION
private static java.lang.String
COMPRESS_EXTENTION
private static java.lang.String
GZIP_EXTENTION
private static java.util.logging.Logger
LOG
logger to log to.static int
ONE_MEGABYTE
-
Constructor Summary
Constructors Modifier Constructor Description private
CompressionManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.InputStream
decompress(java.io.InputStream compressed)
This method decompresses a compressed input stream.static boolean
isCompressed(java.io.File file)
Is a file compressed? (the magic number in the first 2 bytes is used to detect the compression.static boolean
isCompressed(java.lang.String filename)
Is a file compressed? (the magic number in the first 2 bytes is used to detect the compression.protected static ICompressProvider
nextCompressionProvider(int mag1, int mag2, ICompressProvider old)
private static ICompressProvider
selectCompressionProvider(int mag1, int mag2)
-
-
-
Field Detail
-
BZIP2_EXTENTION
private static final java.lang.String BZIP2_EXTENTION
- See Also:
- Constant Field Values
-
COMPRESS_EXTENTION
private static final java.lang.String COMPRESS_EXTENTION
- See Also:
- Constant Field Values
-
GZIP_EXTENTION
private static final java.lang.String GZIP_EXTENTION
- See Also:
- Constant Field Values
-
ONE_MEGABYTE
public static final int ONE_MEGABYTE
- See Also:
- Constant Field Values
-
LOG
private static final java.util.logging.Logger LOG
logger to log to.
-
-
Method Detail
-
decompress
public static java.io.InputStream decompress(java.io.InputStream compressed) throws FitsException
This method decompresses a compressed input stream. The decompression method is selected automatically based upon the first two bytes read.- Parameters:
compressed
- The compressed input stream- Returns:
- A stream which wraps the input stream and decompresses it. If the input stream is not compressed, a pushback input stream wrapping the original stream is returned.
- Throws:
FitsException
- when the stream could not be read or decompressed
-
isCompressed
public static boolean isCompressed(java.io.File file)
Is a file compressed? (the magic number in the first 2 bytes is used to detect the compression.- Parameters:
file
- file to test for compression algorithms- Returns:
- true if the file is compressed
-
isCompressed
public static boolean isCompressed(java.lang.String filename)
Is a file compressed? (the magic number in the first 2 bytes is used to detect the compression.- Parameters:
filename
- of the file to test for compression algorithms- Returns:
- true if the file is compressed
-
selectCompressionProvider
private static ICompressProvider selectCompressionProvider(int mag1, int mag2)
-
nextCompressionProvider
protected static ICompressProvider nextCompressionProvider(int mag1, int mag2, ICompressProvider old)
-
-