public static void process(File file) throws Exception {
Parser parser = new AutoDetectParser();
Metadata metadata = new Metadata();
// The PhoneExtractingContentHandler will examine any characters for phone numbers before passing them
// to the underlying Handler.
PhoneExtractingContentHandler handler = new PhoneExtractingContentHandler(new BodyContentHandler(), metadata);
InputStream stream = new FileInputStream(file);
try {
parser.parse(stream, handler, metadata, new ParseContext());
}
finally {