Examples of POIFSFileSystem


Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

    }
    System.out.println();
  }

  public void testSingleEmptyDocument() throws IOException {
    POIFSFileSystem fs = new POIFSFileSystem();
    DirectoryEntry dir = fs.getRoot();
    dir.createDocument("Foo", new ByteArrayInputStream(new byte[] { }));
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }

  public void testSingleEmptyDocumentEvent() throws IOException {
    POIFSFileSystem fs = new POIFSFileSystem();
    DirectoryEntry dir = fs.getRoot();
    dir.createDocument("Foo", 0, new POIFSWriterListener() {
      public void processPOIFSWriterEvent(POIFSWriterEvent event) {
        System.out.println("written");
      }
    });
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }

  public void testEmptyDocumentWithFriend() throws IOException {
    POIFSFileSystem fs = new POIFSFileSystem();
    DirectoryEntry dir = fs.getRoot();
    dir.createDocument("Bar", new ByteArrayInputStream(new byte[] { 0 }));
    dir.createDocument("Foo", new ByteArrayInputStream(new byte[] { }));
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }

  public void testEmptyDocumentEventWithFriend() throws IOException {
    POIFSFileSystem fs = new POIFSFileSystem();
    DirectoryEntry dir = fs.getRoot();
    dir.createDocument("Bar", 1, new POIFSWriterListener() {
      public void processPOIFSWriterEvent(POIFSWriterEvent event) {
        try {
          event.getStream().write(0);
        } catch (IOException exception) {
          throw new RuntimeException("exception on write: " + exception);
        }
      }
    });
    dir.createDocument("Foo", 0, new POIFSWriterListener() {
      public void processPOIFSWriterEvent(POIFSWriterEvent event) {
      }
    });
   
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    fs.writeFilesystem(out);
    new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
  }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

  * Setup is used to get the document ready. Gets the DocumentSummaryInformation and the
  * SummaryInformation to reasonable values
  */
public void setUp(){
   bout=new ByteArrayOutputStream();
   poifs= new POIFSFileSystem();
     dir = poifs.getRoot();
     dsi=null;
     try
     {
         DocumentEntry dsiEntry = (DocumentEntry)
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

      fail();
    }
      
       InputStream is=new ByteArrayInputStream(bout.toByteArray());
     assertNotNull(is);
     POIFSFileSystem poifs=null;
    try {
      poifs = new POIFSFileSystem(is);
    } catch (IOException e) {

      e.printStackTrace();
      fail();
    }
       try {
      is.close();
    } catch (IOException e) {
      e.printStackTrace();
      fail();
    }
      assertNotNull(poifs);
       /* Read the document summary information. */
       DirectoryEntry dir = poifs.getRoot();
      
       try
       {
           DocumentEntry dsiEntry = (DocumentEntry)
               dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

        super.setUp();
        models = new ArrayList(3);
        factory = new ModelFactory();
        book = new HSSFWorkbook();
        ByteArrayOutputStream stream = (ByteArrayOutputStream)setupRunFile(book);   
        POIFSFileSystem fs = new POIFSFileSystem(
                                   new ByteArrayInputStream(stream.toByteArray())
                                   );
        in = fs.createDocumentInputStream("Workbook");
    }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

            Metadata metadata, ParseContext context)
            throws IOException, SAXException, TikaException {
        XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
        xhtml.startDocument();

        POIFSFileSystem filesystem = new POIFSFileSystem(stream);

        // Parse summary entries first, to make metadata available early
        parseSummaryEntryIfExists(
                filesystem, SUMMARY_INFORMATION, metadata);
        parseSummaryEntryIfExists(
                filesystem, DOCUMENT_SUMMARY_INFORMATION, metadata);

        // Parse remaining document entries
        boolean outlookExtracted = false;
        Iterator<?> entries = filesystem.getRoot().getEntries();
        while (entries.hasNext()) {
            Entry entry = (Entry) entries.next();
            String name = entry.getName();
            if (!(entry instanceof DocumentEntry)) {
                // Skip directory entries
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

  /**
   * For testing only
   */
  public static void main(String args[]) throws Exception {
    HDGFDiagram hdgf = new HDGFDiagram(new POIFSFileSystem(new FileInputStream(args[0])));
    hdgf.debug();
  }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem

        {
            _listener = l;
        }

        //do Ole stuff
        _filesystem = new POIFSFileSystem(istream);

        DocumentEntry headerProps =
            (DocumentEntry)_filesystem.getRoot().getEntry("WordDocument");

        _mainDocument = new byte[headerProps.getSize()];
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.