Java tutorial
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; public class Main { static public final boolean isGzipStm(InputStream in) throws IOException { boolean ms = in.markSupported(); if (ms) in.mark(10); int b1 = in.read(); int b2 = in.read(); if (ms) in.reset(); return ((b2 << 8 | b1) == GZIPInputStream.GZIP_MAGIC); } }