Package org.apache.poi.poifs.filesystem

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


        is.read(docstream);

        try {
            entry = (DocumentEntry)fs.getRoot().getEntry(PICTURES_ENTRY);
            pictstream = new byte[entry.getSize()];
            is = fs.createDocumentInputStream(PICTURES_ENTRY);
            is.read(pictstream);
        } catch(FileNotFoundException e){
            //silently catch errors if the presentation does not contain pictures
        }
    }
View Full Code Here


    // Check that they contain the same data
    byte[] _oData = new byte[oProps.getSize()];
    byte[] _nData = new byte[nProps.getSize()];
    pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
    npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
    for(int i=0; i<_oData.length; i++) {
      //System.out.println(i + "\t" + Integer.toHexString(i));
      assertEquals(_oData[i], _nData[i]);
    }
  }
View Full Code Here

    // Check that they contain the same data
    byte[] _oData = new byte[oProps.getSize()];
    byte[] _nData = new byte[nProps.getSize()];
    pfs.createDocumentInputStream("PowerPoint Document").read(_oData);
    npfs.createDocumentInputStream("PowerPoint Document").read(_nData);
    for(int i=0; i<_oData.length; i++) {
      if(_oData[i] != _nData[i])
        System.out.println(i + "\t" + Integer.toHexString(i));
      assertEquals(_oData[i], _nData[i]);
    }
View Full Code Here

      } else {
        ps = System.out;
      }

      POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(cmdArgs.getFile()));
      InputStream is = fs.createDocumentInputStream("Workbook");

      if (cmdArgs.shouldOutputRawHexOnly()) {
        int size = is.available();
        byte[] data = new byte[size];
View Full Code Here

   public void test54233() throws Exception {
       DocumentInputStream dis;
       POIFSFileSystem fs =
               new POIFSFileSystem(_samples.openResourceAsStream("TestNon4ByteBoundary.doc"));
      
       dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
       SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);
      
       dis = fs.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
       DocumentSummaryInformation dsi = (DocumentSummaryInformation)PropertySetFactory.create(dis);
     
View Full Code Here

               new POIFSFileSystem(_samples.openResourceAsStream("TestNon4ByteBoundary.doc"));
      
       dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
       SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);
      
       dis = fs.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
       DocumentSummaryInformation dsi = (DocumentSummaryInformation)PropertySetFactory.create(dis);
     
       // Test
       assertEquals("Microsoft Word 10.0", si.getApplicationName());
       assertEquals("", si.getTitle());
View Full Code Here

   public void test56138() throws Exception {
       DocumentInputStream dis;
       POIFSFileSystem fs =
               new POIFSFileSystem(_samples.openResourceAsStream("TestZeroLengthCodePage.mpp"));
      
       dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
       SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);
      
       dis = fs.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
       DocumentSummaryInformation dsi = (DocumentSummaryInformation)PropertySetFactory.create(dis);
      
View Full Code Here

               new POIFSFileSystem(_samples.openResourceAsStream("TestZeroLengthCodePage.mpp"));
      
       dis = fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME);
       SummaryInformation si = (SummaryInformation)PropertySetFactory.create(dis);
      
       dis = fs.createDocumentInputStream(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
       DocumentSummaryInformation dsi = (DocumentSummaryInformation)PropertySetFactory.create(dis);
      
       // Test
       assertEquals("MSProject", si.getApplicationName());
       assertEquals("project1", si.getTitle());
View Full Code Here

                  && root.hasEntry("\u0001Ole")
                  && root.hasEntry("\u0001CompObj")
                  && root.hasEntry("\u0003ObjInfo")) {
               // TIKA-704: OLE 2.0 embedded non-Office document?
               stream = TikaInputStream.get(
                     fs.createDocumentInputStream("CONTENTS"));
               if (embeddedExtractor.shouldParseEmbedded(metadata)) {
                  embeddedExtractor.parseEmbedded(
                        stream, new EmbeddedContentHandler(handler),
                        metadata, false);
               }
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

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.