public static TikaInputStream get(URI uri, Metadata metadata) throws IOException {
        // Special handling for file:// URIs
        if ("file".equalsIgnoreCase(uri.getScheme())) {
            Path path = Paths.get(uri);
            if (Files.isRegularFile(path)) {
                return get(path, metadata);
            }
        }

        return get(uri.toURL(), metadata);
    }
Creates a TikaInputStream from the resource at the given URI. The
available input metadata is stored in the given metadata instance.
<p>
Note that you must always explicitly close the returned stream as in
some cases it may end up writing the resource to a temporary file.

@param uri      resource URI
@param metadata metadata instance
@return a TikaInputStream instance
@throws IOException if the resource can not be accessed
tika-core/src/main/java/org/apache/tika/io/TikaInputStream.java