public static InputStream wrapAndCheckCompressionFormat(InputStream in) throws IOException {
  BufferedInputStream bufferedIn=new BufferedInputStream(in);
  if (isZip(bufferedIn)) {
    ZipInputStream zipIn=new ZipInputStream(bufferedIn);
    zipIn.getNextEntry();
    return zipIn;
  }
 else   if (isGZip(bufferedIn)) {
    GZIPInputStream gzipIn=new GZIPInputStream(bufferedIn);
    return gzipIn;
  }
  return bufferedIn;
}

public static InputStream wrapAndCheckCompressionFormat ( InputStream in ) throws IOException { BufferedInputStream bufferedIn = new BufferedInputStream ( in ) ; if ( isZip ( bufferedIn ) ) { ZipInputStream zipIn = new ZipInputStream ( bufferedIn ) ; zipIn . getNextEntry ( ) ; return zipIn ; } else if ( isGZip ( bufferedIn ) ) { GZIPInputStream gzipIn = new GZIPInputStream ( bufferedIn ) ; return gzipIn ; } return bufferedIn ; }
test for zip / gzip stream signature . wraps the input stream in a bufferedinputstream . if zip / gzip test is true wraps again in zipinputstream / gzipinputstream .
