public static InputStream decompress(InputStream compressed) throws FitsException {
  BufferedInputStream pb=new BufferedInputStream(compressed,ONE_MEGABYTE);
  pb.mark(2);
  int mag1=-1;
  int mag2=-1;
  try {
    mag1=pb.read();
    mag2=pb.read();
    pb.reset();
    ICompressProvider selectedProvider=selectCompressionProvider(mag1,mag2);
    if (selectedProvider != null) {
      return selectedProvider.decompress(pb);
    }
 else {
      return pb;
    }
  }
 catch (  IOException e) {
    throw new FitsException("Unable to analyze input stream",e);
  }
}

public static InputStream decompress ( InputStream compressed ) throws FitsException { BufferedInputStream pb = new BufferedInputStream ( compressed , ONE_MEGABYTE ) ; pb . mark ( 2 ) ; int mag1 = - 1 ; int mag2 = - 1 ; try { mag1 = pb . read ( ) ; mag2 = pb . read ( ) ; pb . reset ( ) ; ICompressProvider selectedProvider = selectCompressionProvider ( mag1 , mag2 ) ; if ( selectedProvider != null ) { return selectedProvider . decompress ( pb ) ; } else { return pb ; } } catch ( IOException e ) { throw new FitsException ( "Unable to analyze input stream" , e ) ; } }
this method decompresses a compressed input stream . the decompression method is selected automatically based upon the first two bytes read .
