Class ExternalBZip2CompressionProvider

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

@Deprecated public class ExternalBZip2CompressionProvider extends Object implements ICompressProvider
Deprecated.
Use ZCompressionProvider, or the more generic CompressionManager with a preference toward using the system command if possible, instead.
(for internal use) BZIP2 (.bz2) input stream decompression with a preference for using an external system command. You can use this class to decompress files that have been compressed with the UNIX bzip2 tool and have the characteristic .bz2 file name extension. It effectively provides the same functionality as BZip2CompressionProvider, but has a preference for calling on the system bzip2 command first to do the lifting. If that fails it will call on CompressionManager to provide a suitable decompressor (which will give it BZip2CompressionProvider). Since the bzip2 tool is UNIX-specific, it is not entirely portable. It also requires the environment variable BZIP_DECOMPRESSOR to be set to provide the system executable to use. As a result, you are probably better off relying on the mentioned other classes directly for this functionality.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Decompresses data from an input stream.
    Deprecated.
    Returns the system command to use for decompressing .bz2 compressed files.
    int
    Deprecated.
    Returns the priority of this method.
    boolean
    provides(int mag1, int mag2)
    Deprecated.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExternalBZip2CompressionProvider

      public ExternalBZip2CompressionProvider()
      Deprecated.
  • Method Details

    • getBzip2Cmd

      public String getBzip2Cmd()
      Deprecated.
      Returns the system command to use for decompressing .bz2 compressed files. It requires the BZIP_DECOMPRESSOR environment variable to be set to inform us as to what executable (including path) should be used. If there is no such environment variable set, it will return null
      Returns:
      The system command for decompressing .bz2 files, or null if there is no BZIP_DECOMPRESSOR environment variable that could inform us.
    • decompress

      public InputStream decompress(InputStream in) throws IOException, FitsException
      Deprecated.
      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
      FitsException - if the decompression cannot be performed for some reason that is not related to the input per se.
    • priority

      public int priority()
      Deprecated.
      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)
      Deprecated.
      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.