public static boolean isCompressed(File file){
  InputStream fis=null;
  try {
    if (file.exists()) {
      fis=new FileInputStream(file);
      int mag1=fis.read();
      int mag2=fis.read();
      fis.close();
      return selectCompressionProvider(mag1,mag2) != null;
    }
  }
 catch (  IOException e) {
    LOG.log(Level.FINEST,"Error while checking if file " + file + " is compressed",e);
    return false;
  }
 finally {
    SafeClose.close(fis);
  }
  return false;
}

public static boolean isCompressed ( File file ) { InputStream fis = null ; try { if ( file . exists ( ) ) { fis = new FileInputStream ( file ) ; int mag1 = fis . read ( ) ; int mag2 = fis . read ( ) ; fis . close ( ) ; return selectCompressionProvider ( mag1 , mag2 ) != null ; } } catch ( IOException e ) { LOG . log ( Level . FINEST , "Error while checking if file " + file + " is compressed" , e ) ; return false ; } finally { SafeClose . close ( fis ) ; } return false ; }
is a file compressed ? ( the magic number in the first 2 bytes is used to detect the compression .
