static InputStream getPOIFSInputStream(POIFSFileSystem fs) throws IOException { String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot()); return fs.createDocumentInputStream(workbookName); }
poifs.writeFilesystem(bos); } else { try (final InputStream is2 = poifs.createDocumentInputStream(entryName)) { IOUtils.copy(is2, bos);
POIFSFileSystem fs = new POIFSFileSystem(pPart.getInputStream()); TikaInputStream stream = null; stream = TikaInputStream.get(fs.createDocumentInputStream("CONTENTS")); bytes = IOUtils.toByteArray(stream); String encoded = Base64.encodeBase64String(bytes);
POIFSFileSystem poifs = new POIFSFileSystem(input); DocumentInputStream documentInputStream = poifs.createDocumentInputStream("Workbook"); factory.processRecords(documentInputStream);
pfs.createDocumentInputStream(OLE_DOCUMENT_NAME))) { Context ctx = new Context(in, xhtml, metadata); while (hasNext(in)) {
/** * Creates an extractor from a POIFS Filesystem * @param poifs */ public QuickButCruddyTextExtractor(POIFSFileSystem poifs) throws IOException { fs = poifs; // Find the PowerPoint bit, and get out the bytes InputStream pptIs = fs.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT); pptContents = IOUtils.toByteArray(pptIs); pptIs.close(); }
FileInputStream file = new FileInputStream("c:\\temp\\a.xls"); POIFSFileSystem poifs = new POIFSFileSystem(file); InputStream stream = poifs.createDocumentInputStream("Workbook");
/** * Constructs a Powerpoint dump from a POIFS Filesystem. Parses the * document and dumps out the contents * * @param filesystem the POIFS FileSystem to read from * @throws IOException if there is a problem while parsing the document. */ public SlideShowDumper(POIFSFileSystem filesystem, PrintStream out) throws IOException { // Grab the document stream InputStream is = filesystem.createDocumentInputStream(HSLFSlideShow.POWERPOINT_DOCUMENT); docstream = IOUtils.toByteArray(is); is.close(); this.out = out; }
InputStream in = new FileInputStream(f); XWPFDocument doc = new XWPFDocument(in); for (PackagePart p : doc.getAllEmbedds()) { POIFSFileSystem poifs = new POIFSFileSystem(p.getInputStream()); byte[] oleData = IOUtils.toByteArray( poifs.createDocumentInputStream("Equation Native")); }
static InputStream getPOIFSInputStream(POIFSFileSystem fs) throws IOException { String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot()); return fs.createDocumentInputStream(workbookName); }
fs.createDocumentInputStream("CONTENTS")); } else if (root.hasEntry("Package")) { fs.createDocumentInputStream("Package")); } else { throw new IllegalStateException("Shouldn't ever arrive here; please open a ticket on our jira");
public static List getTypes(InputStream istream) throws IOException { List results = new ArrayList(1); //do Ole stuff POIFSFileSystem filesystem = new POIFSFileSystem(istream); DocumentEntry headerProps = (DocumentEntry)filesystem.getRoot().getEntry("WordDocument"); byte[] mainDocument = new byte[headerProps.getSize()]; filesystem.createDocumentInputStream("WordDocument").read(mainDocument); FileInformationBlock fib = new FileInformationBlock(mainDocument); results.add(fib); return results; }
/** * Creates an extractor from a POIFS Filesystem * @param poifs */ public QuickButCruddyTextExtractor(POIFSFileSystem poifs) throws IOException { fs = poifs; // Find the PowerPoint bit, and get out the bytes DocumentEntry docProps = (DocumentEntry)fs.getRoot().getEntry("PowerPoint Document"); pptContents = new byte[docProps.getSize()]; fs.createDocumentInputStream("PowerPoint Document").read(pptContents); }
InputStream stream = new FileInputStream("C:\\Thumbs.db"); POIFSFileSystem fs = new POIFSFileSystem(stream); DirectoryEntry root = fs.getRoot(); Entry entry = root.getEntry("2"); DocumentInputStream is = fs.createDocumentInputStream(entry.getName()); //Added to read the header lines and fix the ImageFormatException int header_len = is.read(); for (int i = 1; i < header_len; i++) { is.read(); } JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(is); JPEGDecodeParam param = JPEGCodec.getDefaultJPEGEncodeParam(4,JPEGDecodeParam.COLOR_ID_RGBA); decoder.setJPEGDecodeParam(param); BufferedImage originalBufferedImage = decoder.decodeAsBufferedImage();
protected void initWordHeader(InputStream in) throws IOException, PasswordProtectedException { _fsys = new POIFSFileSystem(in); // load our POIFS document streams. DocumentEntry headerProps = (DocumentEntry)_fsys.getRoot().getEntry("WordDocument"); DocumentInputStream din = _fsys.createDocumentInputStream("WordDocument"); _header = new byte[headerProps.getSize()]; din.read(_header); din.close(); }
public ExcelTextExtractor(InputStream in) throws IOException { POIFSFileSystem poifs = new POIFSFileSystem(in); DocumentEntry headerProps = (DocumentEntry)poifs.getRoot().getEntry("Workbook"); DocumentInputStream din = poifs.createDocumentInputStream("Workbook"); _recordStream = new byte[headerProps.getSize()]; din.read(_recordStream); din.close(); } public String getText() throws IOException
public ExcelTextExtractor(InputStream in) throws IOException { POIFSFileSystem poifs = new POIFSFileSystem(in); DocumentEntry headerProps = (DocumentEntry)poifs.getRoot().getEntry("Workbook"); DocumentInputStream din = poifs.createDocumentInputStream("Workbook"); _recordStream = new byte[headerProps.getSize()]; din.read(_recordStream); din.close(); } public String getText() throws IOException
protected void initWordHeader(InputStream in) throws IOException, PasswordProtectedException { _fsys = new POIFSFileSystem(in); // load our POIFS document streams. DocumentEntry headerProps = (DocumentEntry)_fsys.getRoot().getEntry("WordDocument"); DocumentInputStream din = _fsys.createDocumentInputStream("WordDocument"); _header = new byte[headerProps.getSize()]; din.read(_header); din.close(); }
protected void initWordHeader(InputStream in) throws IOException, PasswordProtectedException { _fsys = new POIFSFileSystem(in); // load our POIFS document streams. DocumentEntry headerProps = (DocumentEntry)_fsys.getRoot().getEntry("WordDocument"); DocumentInputStream din = _fsys.createDocumentInputStream("WordDocument"); _header = new byte[headerProps.getSize()]; din.read(_header); din.close(); initOptions(); }
protected void initWordHeader(InputStream in) throws IOException, PasswordProtectedException { _fsys = new POIFSFileSystem(in); // load our POIFS document streams. DocumentEntry headerProps = (DocumentEntry)_fsys.getRoot().getEntry("WordDocument"); DocumentInputStream din = _fsys.createDocumentInputStream("WordDocument"); _header = new byte[headerProps.getSize()]; din.read(_header); din.close(); initOptions(); }