ChunkedDocumentReader { public ChunkedDocument readDocument(InputStream input, String id) throws ExtractorException { StringWriter writer = new StringWriter(); InputStreamReader reader = new InputStreamReader(input); try { FileUtils.pipe(reader, writer); return readDocument(writer.toString(), id); } catch (IOException e) { String msg = String.format("Could not read document %s", id); throw new ExtractorException(msg, e); } } ChunkedDocumentReader(SentenceExtractor sentExtractor,
            SentenceChunker sentChunker);  ChunkedDocumentReader(SentenceExtractor sentExtractor);  ChunkedDocumentReader(SentenceChunker sentChunker);  ChunkedDocumentReader(); SentenceExtractor getSentenceExtractor(); SentenceChunker getSentenceChunker(); ChunkedDocument readDocument(InputStream input, String id); ChunkedDocument readDocument(File file); ChunkedDocument readDocument(String docStr, String id);  }
@Test public void testReadDocumentInputStreamString() throws Exception { ChunkedDocument doc = reader.readDocument(docStream, "myDoc"); assertEquals("myDoc", doc.getId()); assertEquals(2, doc.getSentences().size()); }
@Test public void testReadDocumentFile() throws Exception { File temp = folder.newFile("tmp"); FileWriter w = new FileWriter(temp); w.write(docStr); w.close(); ChunkedDocument doc = reader.readDocument(temp); assertEquals(temp.getAbsolutePath(), doc.getId()); assertEquals(2, doc.getSentences().size()); }
@Test public void testReadDocumentStringString() throws Exception { ChunkedDocument doc = reader.readDocument(docStr, "myDoc"); assertEquals("myDoc", doc.getId()); assertEquals(2, doc.getSentences().size()); }