@Override
    public MediaType detect(InputStream input, Metadata metadata) throws IOException {
        if (input == null) {
            return MediaType.OCTET_STREAM;
        }
        input.mark(2);
        byte[] firstTwo = new byte[2];
        try {
            // do not change this to commons-io IOUtils.readFully because
            // org.apache.tika.parser.AutoDetectParserConfigTest tests will fail
            org.apache.commons.compress.utils.IOUtils.readFully(input, firstTwo);
        } finally {
            input.reset();
        }
        int magic = ((firstTwo[1] & 0xff) << 8) | (firstTwo[0] & 0xff);
        if (GZIPInputStream.GZIP_MAGIC != magic) {
            return MediaType.OCTET_STREAM;
        }
        return detectSpecialization(input, metadata);
    }
This is designed to detect commonly gzipped file types such as warc.gz.
This is a first step.  We still need to implement tar.gz and svg.gz and ???
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pkg-module/src/main/java/org/apache/tika/detect/gzip/GZipSpecializationDetector.java