Examples of DocumentEntry


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

                    UnexpectedPropertySetTypeException
            {
                /* Read a test document <em>doc</em> into a POI filesystem. */
                final POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(file));
                final DirectoryEntry dir = poifs.getRoot();
                DocumentEntry dsiEntry = null;
                try
                {
                    dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
                }
                catch (FileNotFoundException ex)
View Full Code Here

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

    bout = new ByteArrayOutputStream();
    poifs = new POIFSFileSystem();
    dir = poifs.getRoot();
    dsi = null;
    try {
      DocumentEntry dsiEntry = (DocumentEntry) dir
          .getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
      DocumentInputStream dis = new DocumentInputStream(dsiEntry);
      PropertySet ps = new PropertySet(dis);
      dis.close();
      dsi = new DocumentSummaryInformation(ps);

    } catch (FileNotFoundException ex) {
      /*
       * There is no document summary information yet. We have to create a
       * new one.
       */
      dsi = PropertySetFactory.newDocumentSummaryInformation();
      assertNotNull(dsi);
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
    assertNotNull(dsi);
    try {
      DocumentEntry dsiEntry = (DocumentEntry) dir
          .getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
      DocumentInputStream dis = new DocumentInputStream(dsiEntry);
      PropertySet ps = new PropertySet(dis);
      dis.close();
      si = new SummaryInformation(ps);
View Full Code Here

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

    assertNotNull(poifs);
    /* Read the document summary information. */
    DirectoryEntry dir = poifs.getRoot();

    try {
      DocumentEntry dsiEntry = (DocumentEntry) dir
          .getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
      DocumentInputStream dis = new DocumentInputStream(dsiEntry);
      PropertySet ps = new PropertySet(dis);
      dis.close();
      dsi = new DocumentSummaryInformation(ps);
    } catch (FileNotFoundException ex) {
      fail();
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
    try {
      DocumentEntry dsiEntry = (DocumentEntry) dir
          .getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
      DocumentInputStream dis = new DocumentInputStream(dsiEntry);
      PropertySet ps = new PropertySet(dis);
      dis.close();
      si = new SummaryInformation(ps);
View Full Code Here

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

   * @throws IOException
   */
  private void readFIB() throws IOException
  {
  // Get the main document stream
  DocumentEntry docProps =
    (DocumentEntry)filesystem.getRoot().getEntry("PowerPoint Document");

  // Grab the document stream
  _docstream = new byte[docProps.getSize()];
  filesystem.createDocumentInputStream("PowerPoint Document").read(_docstream);

  // The format of records in a powerpoint file are:
  //   <little endian 2 byte "info">
  //   <little endian 2 byte "type">
View Full Code Here

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

  {
    //do Ole stuff
    POIFSFileSystem filesystem = new POIFSFileSystem(istream);

    // read in the main stream.
    DocumentEntry documentProps =
       (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");
    _mainStream = new byte[documentProps.getSize()];
    filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

    // use the fib to determine the name of the table stream.
    _fib = new FileInformationBlock(_mainStream);

    String name = "0Table";
    if (_fib.isFWhichTblStm())
    {
      name = "1Table";
    }

    // read in the table stream.
    DocumentEntry tableProps =
      (DocumentEntry)filesystem.getRoot().getEntry(name);
    _tableStream = new byte[tableProps.getSize()];
    filesystem.createDocumentInputStream(name).read(_tableStream);

    _fib.fillVariableFields(_mainStream, _tableStream);

    // read in the data stream.
    try
    {
      DocumentEntry dataProps =
          (DocumentEntry) filesystem.getRoot().getEntry("Data");
      _dataStream = new byte[dataProps.getSize()];
      filesystem.createDocumentInputStream("Data").read(_dataStream);
    }
    catch(java.io.FileNotFoundException e)
    {
        _dataStream = new byte[0];
View Full Code Here

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


      POIFSFileSystem filesystem = new POIFSFileSystem(new FileInputStream(
        new File(filename)));

      DocumentEntry documentProps =
        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
      _mainStream = new byte[documentProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

      // use the fib to determine the name of the table stream.
      _fib = new FileInformationBlock(_mainStream);

      String name = "0Table";
      if (_fib.isFWhichTblStm())
      {
        name = "1Table";
      }

      // read in the table stream.
      DocumentEntry tableProps =
        (DocumentEntry) filesystem.getRoot().getEntry(name);
      _tableStream = new byte[tableProps.getSize()];
      filesystem.createDocumentInputStream(name).read(_tableStream);

      _fib.fillVariableFields(_mainStream, _tableStream);
    }
    catch (Throwable t)
View Full Code Here

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

  public SlideShowDumper(POIFSFileSystem filesystem) throws IOException
  {
  this.filesystem = filesystem;

  // Get the main document stream
  DocumentEntry docProps =
    (DocumentEntry)filesystem.getRoot().getEntry("PowerPoint Document");

  // Grab the document stream
  _docstream = new byte[docProps.getSize()];
  filesystem.createDocumentInputStream("PowerPoint Document").read(_docstream);
  }
View Full Code Here

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

   * @throws IOException
   */
  private void readPowerPointStream() throws IOException
  {
    // Get the main document stream
    DocumentEntry docProps =
      (DocumentEntry)directory.getEntry("PowerPoint Document");

    // Grab the document stream
    _docstream = new byte[docProps.getSize()];
    directory.createDocumentInputStream("PowerPoint Document").read(_docstream);
  }
View Full Code Here

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

        _pictures = new ArrayList<PictureData>();

    byte[] pictstream;

    try {
      DocumentEntry entry = (DocumentEntry)directory.getEntry("Pictures");
      pictstream = new byte[entry.getSize()];
      DocumentInputStream is = directory.createDocumentInputStream("Pictures");
      is.read(pictstream);
    } catch (FileNotFoundException e){
      // Silently catch exceptions if the presentation doesn't
      //  contain pictures - will use a null set instead
View Full Code Here

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

   */
  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);
  }
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.