Package org.apache.poi.poifs.filesystem

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem.createDocumentInputStream()


    public void run()
        throws IOException
    {
        FileInputStream fin   = new FileInputStream(file);
        POIFSFileSystem poifs = new POIFSFileSystem(fin);
        InputStream     din   = poifs.createDocumentInputStream("Workbook");
        HSSFRequest     req   = new HSSFRequest();

        req.addListenerForAllRecords(new HSSFListener()
        {
            public void processRecord(Record rec)
View Full Code Here


        book = new HSSFWorkbook();
        ByteArrayOutputStream stream = (ByteArrayOutputStream)setupRunFile(book);   
        POIFSFileSystem fs = new POIFSFileSystem(
                                   new ByteArrayInputStream(stream.toByteArray())
                                   );
        in = fs.createDocumentInputStream("Workbook");
    }

    protected void tearDown() throws Exception
    {
        super.tearDown();
View Full Code Here

        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);
View Full Code Here

    public void run() {
        try {
            POIFSFileSystem fs =
                    new POIFSFileSystem(new FileInputStream(filename));
            InputStream stream =
                    fs.createDocumentInputStream("Workbook");
            Record[] records = createRecords(stream, dump);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

            }
            if ((args.length > 1) && args[1].equals("bfd")) {
                POIFSFileSystem fs =
                        new POIFSFileSystem(new FileInputStream(args[0]));
                InputStream stream =
                        fs.createDocumentInputStream("Workbook");
                int size = stream.available();
                byte[] data = new byte[size];

                stream.read(data);
                HexDump.dump(data, 0, System.out, 0);
View Full Code Here

  protected static InputStream getPOIFSInputStream(File file)
      throws IOException, FileNotFoundException {
    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file));
    String workbookName = HSSFWorkbook.getWorkbookDirEntryName(fs.getRoot());
    return fs.createDocumentInputStream(workbookName);
  }

  protected static void runBiffViewer(PrintStream ps, InputStream is,
      boolean dumpInterpretedRecords, boolean dumpHex, boolean zeroAlignHexDump,
      boolean suppressHeader) {
View Full Code Here

    POIFSFileSystem fsys = new POIFSFileSystem(in);

    // load our POIFS document streams.
    DocumentEntry headerProps =
        (DocumentEntry)fsys.getRoot().getEntry("WordDocument");
    DocumentInputStream din = fsys.createDocumentInputStream("WordDocument");
    byte[] header = new byte[headerProps.getSize()];


    din.read(header);
    din.close();
View Full Code Here

    }

    DocumentEntry table = (DocumentEntry)fsys.getRoot().getEntry(tableName);
    byte[] tableStream = new byte[table.getSize()];

    din = fsys.createDocumentInputStream(tableName);

    din.read(tableStream);
    din.close();

    int chpOffset = LittleEndian.getInt(header, 0xfa);
View Full Code Here

      ERFListener erfListener = null; // new MyERFListener();
      EventRecordFactory erf = new EventRecordFactory(erfListener, null);
      try {
        POIFSFileSystem fs = new POIFSFileSystem(new ByteArrayInputStream(baos.toByteArray()));
        erf.processRecords(fs.createDocumentInputStream("Workbook"));
      } catch (RecordFormatException e) {
        throw new RuntimeException(e);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
View Full Code Here

     
      // Now process it through eventusermodel, and
      //  look out for the title records
      ChartTitleFormatRecordGrabber grabber =
        new ChartTitleFormatRecordGrabber();
      InputStream din = fs.createDocumentInputStream("Workbook");
        HSSFRequest req = new HSSFRequest();
        req.addListenerForAllRecords(grabber);
        HSSFEventFactory factory = new HSSFEventFactory();
        factory.processEvents(req, din);
        din.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.