public String parseExample() throws IOException, SAXException, TikaException {
        AutoDetectParser parser = new AutoDetectParser();
        BodyContentHandler handler = new BodyContentHandler();
        Metadata metadata = new Metadata();
        try (InputStream stream = ParsingExample.class.getResourceAsStream("test.doc")) {
            parser.parse(stream, handler, metadata);
            return handler.toString();
        }
    }
Example of how to use Tika to parse a file when you do not know its file type
ahead of time.
<p>
AutoDetectParser attempts to discover the file's type automatically, then call
the exact Parser built for that file type.
<p>
The stream to be parsed by the Parser. In this case, we get a file from the
resources folder of this project.
<p>
Handlers are used to get the exact information you want out of the host of
information gathered by Parsers. The body content handler, intuitively, extracts
everything that would go between HTML body tags.
<p>
The Metadata object will be filled by the Parser with Metadata discovered about
the file being parsed.
<p>
Note: This example will extract content from the outer document and all
embedded documents.  However, if you choose to use a {@link ParseContext},
make sure to set a {@link Parser} or else embedded content will not be
parsed.

@return The content of a file.
tika-example/src/main/java/org/apache/tika/example/ParsingExample.java