public MediaType detect(InputStream stream, Metadata metadata) throws IOException {
        if (stream != null) {
            try {
                stream.mark(1);
                if (stream.read() == -1) {
                    return MediaType.EMPTY;
                }
            } finally {
                stream.reset();
            }
        }
        return MediaType.OCTET_STREAM;
    }
Detector to identify zero length files as application/x-zerovalue
tika-core/src/main/java/org/apache/tika/detect/ZeroSizeFileDetector.java