Class BZip2CompressionProvider

java.lang.Object
nom.tam.fits.compress.BZip2CompressionProvider
All Implemented Interfaces:
ICompressProvider

public class BZip2CompressionProvider extends Object implements ICompressProvider
(for internal use) BZIP2 (.bz2) input stream decompression. You can use this class to decompress files that have been compressed with bzip2, or use CompressionManager to automatically detect the type of compression used. This class uses the Apache commons-compress package to perform the decompression.
See Also:
  • Constructor Details

    • BZip2CompressionProvider

      public BZip2CompressionProvider()
  • Method Details

    • decompress

      public InputStream decompress(InputStream in) throws IOException
      Description copied from interface: ICompressProvider
      Decompresses data from an input stream.
      Specified by:
      decompress in interface ICompressProvider
      Parameters:
      in - the input stream containing compressed data
      Returns:
      a new input stream containing the decompressed data
      Throws:
      IOException - if there was an IO error while accessing the input stream
    • priority

      public int priority()
      Description copied from interface: ICompressProvider
      Returns the priority of this method. CompressionManager will use this to select the 'best' compression class when multiple compression classes can provide decompression support for a given input stream. Claases that have a higher priority will be preferred.
      Specified by:
      priority in interface ICompressProvider
      Returns:
      the priority of this decompression method vs similar other compression methods that may be avaialble.
      See Also:
    • provides

      public boolean provides(int mag1, int mag2)
      Description copied from interface: ICompressProvider
      Checks if this compression method can support the magic integer number that is used to identify the type of compression at the beginning of compressed files, and is stored as the first 2 bytes of compressed data.
      Specified by:
      provides in interface ICompressProvider
      Parameters:
      mag1 - the first byte of the compressed file
      mag2 - the second byte of the compressed file
      Returns:
      true if this class can be used to decompress the given file, or else false.