private static CompressType checkCompressType(InputStream inputStream) {
    CompressType compressType = CompressType.NONE;
    byte[] header = new byte[2];
    try {
      int length = inputStream.read(header);
      if(length == 2) {

        if (header[0] == MAGIC_ZIP_BYTE_1 && header[1] == MAGIC_ZIP_BYTE_2) {
          compressType = CompressType.ZIP;
        } else if ((header[0] == (byte) (GZIPInputStream.GZIP_MAGIC))
          && (header[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8))) {
          compressType = CompressType.GZIP;
        }
      }
    } catch (IOException e) {
      //No Action
    }
    return compressType;

  }
Check the first two bytes of a InputStream.
If the bytes equals {@link GZIPInputStream#GZIP_MAGIC} the file is
compressed by gzip
If the bytes equals {@link #MAGIC_ZIP_BYTE_1} and {@link #MAGIC_ZIP_BYTE_2} the file is compressed by ZIP
olv-core/src/main/java/pl/otros/logview/api/io/LoadingInfo.java