public String detect(URL url) throws IOException {
        Metadata metadata = new Metadata();
        try (InputStream stream = TikaInputStream.get(url, metadata)) {
            return detect(stream, metadata);
        }
    }
Detects the media type of the resource at the given URL. The type
detection is based on the document content and a potential known
file extension included in the URL.
<p>
Use the {@link #detect(String)} method when you want to detect the
type of the document without actually accessing the URL.

@param url the URL of the resource
@return detected media type
@throws IOException if the resource can not be read
tika-core/src/main/java/org/apache/tika/Tika.java