return image;
}
private static Document newDocument(String filename, InputStream inputStream)
throws IOException {
Document document = new Document();
document.setId(Filenames.asId(filename));
document.setTitle(Filenames.asTitle(filename));
document.setLastModified(new Date());
document.setContentType(Filenames.asContentType(filename));
copyStreamToFile(inputStream, document.getFile());
// Trigger conversion to plain text
document.getText();
return document;
}