Examples of DocumentEntry


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

   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 (IOException e) {
    e.printStackTrace();
    fail();
  } catch (NoPropertySetStreamException e) {
    e.printStackTrace();
    fail();
  } catch (MarkUnsupportedException e) {
    e.printStackTrace();
    fail();
  } catch (UnexpectedPropertySetTypeException 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

       /* 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 (IOException e) {
      e.printStackTrace();
      fail();
    } catch (NoPropertySetStreamException e) {
      e.printStackTrace();
      fail();
    } catch (MarkUnsupportedException e) {
      e.printStackTrace();
      fail();
    } catch (UnexpectedPropertySetTypeException 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

    private void parseSummaryEntryIfExists(
            POIFSFileSystem filesystem, String entryName, Metadata metadata)
            throws IOException, TikaException {
        try {
            DocumentEntry entry =
                (DocumentEntry) filesystem.getRoot().getEntry(entryName);
            PropertySet properties =
                new PropertySet(new DocumentInputStream(entry));
            if (properties.isSummaryInformation()) {
                parse(new SummaryInformation(properties), metadata);
View Full Code Here

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

    this(fs.getRoot(), fs);
  }
  public HDGFDiagram(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
    super(dir, fs);

    DocumentEntry docProps =
      (DocumentEntry)dir.getEntry("VisioDocument");

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

    // Read in the common POI streams
    readProperties();
View Full Code Here

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

        }

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

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

        _mainDocument = new byte[headerProps.getSize()];
        _filesystem.createDocumentInputStream("WordDocument").read(_mainDocument);

        _fib = new FileInformationBlock(_mainDocument);

        initTableStream();
View Full Code Here

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

        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);

View Full Code Here

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

        else
        {
          tablename="0Table";
        }

        DocumentEntry tableEntry = (DocumentEntry)_filesystem.getRoot().getEntry(tablename);

        //load the table stream into a buffer
        int size = tableEntry.getSize();
        _tableBuffer = new byte[size];
        _filesystem.createDocumentInputStream(tablename).read(_tableBuffer);
    }
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 headerProps =
        (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");

      //I call it the header but its also the main document stream
      _header = new byte[headerProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_header);

      //Get the information we need from the header
      int info = LittleEndian.getShort(_header, 0xa);

View Full Code Here

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

      //get the location of the piece table
      int complexOffset = LittleEndian.getInt(_header, 0x1a2);

      String tablename=null;
      DocumentEntry tableEntry = null;
      if(useTable1)
      {
          tablename="1Table";
      }
      else
      {
          tablename="0Table";
      }
      tableEntry = (DocumentEntry)filesystem.getRoot().getEntry(tablename);

      //load the table stream into a buffer
      int size = tableEntry.getSize();
      byte[] tableStream = new byte[size];
      filesystem.createDocumentInputStream(tablename).read(tableStream);

      //init the DOP for this document
      initDocProperties(tableStream);
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
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.