@Test public void testByDefaultExtractsContentMetadataAndLanguage() throws Exception { TikaStage stage = new TikaStage(); LocalDocument doc = buildDocumentWithResourceFile("/test.pdf"); stage.process(doc); assertThat(doc.getContentFieldAsString("test_pdf_Author"), equalTo("Bertrand Delacrétaz")); assertThat(doc.getContentFieldAsString("test_pdf_content"), containsString("Tika is a toolkit for detecting and extracting metadata and structured text content")); assertThat(doc.getContentFieldAsString("test_pdf_language"), equalTo("en")); }
@Override public void process(LocalDocument doc) throws TikaException, SAXException, IOException { List<String> files = doc.getFileNames(); DocumentParserHelper documentParserHelper = new DocumentParserHelper(addMetaData, addLanguage); for (String fileName : files) { DocumentFile<Local> df = doc.getFile(fileName); String prefix = fileName.replace('.', '_') + "_"; InputStreamParser inputStreamParser = new InputStreamParser(parser); ParsedData parsedData = inputStreamParser.parse(df.getStream()); documentParserHelper.addParsedDataToDocument(parsedData, doc, prefix); } }
TikaStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws TikaException, SAXException, IOException { List<String> files = doc.getFileNames(); DocumentParserHelper documentParserHelper = new DocumentParserHelper(addMetaData, addLanguage); for (String fileName : files) { DocumentFile<Local> df = doc.getFile(fileName); String prefix = fileName.replace('.', '_') + "_"; InputStreamParser inputStreamParser = new InputStreamParser(parser); ParsedData parsedData = inputStreamParser.parse(df.getStream()); documentParserHelper.addParsedDataToDocument(parsedData, doc, prefix); } } }
TikaStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws TikaException, SAXException, IOException { List<String> files = doc.getFileNames(); DocumentParserHelper documentParserHelper = new DocumentParserHelper(addMetaData, addLanguage); for (String fileName : files) { DocumentFile<Local> df = doc.getFile(fileName); String prefix = fileName.replace('.', '_') + "_"; InputStreamParser inputStreamParser = new InputStreamParser(parser); ParsedData parsedData = inputStreamParser.parse(df.getStream()); documentParserHelper.addParsedDataToDocument(parsedData, doc, prefix); } }  }
TikaStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws TikaException, SAXException, IOException { List<String> files = doc.getFileNames(); DocumentParserHelper documentParserHelper = new DocumentParserHelper(addMetaData, addLanguage); for (String fileName : files) { DocumentFile<Local> df = doc.getFile(fileName); String prefix = fileName.replace('.', '_') + "_"; InputStreamParser inputStreamParser = new InputStreamParser(parser); ParsedData parsedData = inputStreamParser.parse(df.getStream()); documentParserHelper.addParsedDataToDocument(parsedData, doc, prefix); } }  @Override void process(LocalDocument doc); boolean isAddMetaData(); void setAddMetaData(boolean addMetaData); boolean isAddLanguage(); void setAddLanguage(boolean addLanguage); }
TikaStage extends AbstractProcessStage { @Override public void process(LocalDocument doc) throws TikaException, SAXException, IOException { List<String> files = doc.getFileNames(); DocumentParserHelper documentParserHelper = new DocumentParserHelper(addMetaData, addLanguage); for (String fileName : files) { DocumentFile<Local> df = doc.getFile(fileName); String prefix = fileName.replace('.', '_') + "_"; InputStreamParser inputStreamParser = new InputStreamParser(parser); ParsedData parsedData = inputStreamParser.parse(df.getStream()); documentParserHelper.addParsedDataToDocument(parsedData, doc, prefix); } }  @Override void process(LocalDocument doc); boolean isAddMetaData(); void setAddMetaData(boolean addMetaData); boolean isAddLanguage(); void setAddLanguage(boolean addLanguage);  }