Examples of DirectoryNode


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

        try {
            Metadata metadata = new Metadata();
            TikaInputStream stream = null;
            metadata.set(Metadata.EMBEDDED_RELATIONSHIP_ID, rel);

            DirectoryNode root = fs.getRoot();
            POIFSDocumentType type = POIFSDocumentType.detectType(root);
           
            if (root.hasEntry("CONTENTS")
                  && 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(
View Full Code Here

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

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

        final DirectoryNode root;
        TikaInputStream tstream = TikaInputStream.cast(stream);
        if (tstream == null) {
            root = new NPOIFSFileSystem(new CloseShieldInputStream(stream)).getRoot();
        } else {
            final Object container = tstream.getOpenContainer();
View Full Code Here

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

    String filename = pdirname + "/word_with_embeded.doc";
    POIFSFileSystem fs = new POIFSFileSystem(
        new FileInputStream(filename)
    );
   
    DirectoryNode objPool = (DirectoryNode)
      fs.getRoot().getEntry("ObjectPool");
    DirectoryNode dirA = (DirectoryNode)
      objPool.getEntry("_1269427460");
    DirectoryNode dirB = (DirectoryNode)
      objPool.getEntry("_1269427461");

    HSSFWorkbook wbA = new HSSFWorkbook(dirA, fs, true);
    HSSFWorkbook wbB = new HSSFWorkbook(dirB, fs, true);
   
View Full Code Here

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

    String filename = pdirname + "/excel_with_embeded.xls";
    POIFSFileSystem fs = new POIFSFileSystem(
        new FileInputStream(filename)
    );
   
      DirectoryNode dirA = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B5");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B4");
   
    HSSFWorkbook wbA = new HSSFWorkbook(dirA, fs, true);
    HSSFWorkbook wbB = new HSSFWorkbook(dirB, fs, true);
   
View Full Code Here

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

    public void testExtractFromEmbeded() throws Exception {
      POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename3));
      HWPFDocument doc;
      WordExtractor extractor3;
     
      DirectoryNode dirA = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B7");
      DirectoryNode dirB = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B2");
     
      // Should have WordDocument and 1Table
      assertNotNull(dirA.getEntry("1Table"));
      assertNotNull(dirA.getEntry("WordDocument"));
     
      assertNotNull(dirB.getEntry("1Table"));
      assertNotNull(dirB.getEntry("WordDocument"));
     
      // Check each in turn
      doc = new HWPFDocument(dirA, fs);
      extractor3 = new WordExtractor(doc);
   
View Full Code Here

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

      POIFSFileSystem fs = new POIFSFileSystem(
          new FileInputStream(filename3)
      );
      HSLFSlideShow ss;
     
      DirectoryNode dirA = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B6");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B3");
   
    assertNotNull(dirA.getEntry("PowerPoint Document"));
    assertNotNull(dirB.getEntry("PowerPoint Document"));
     
    // Check the first file
      ss = new HSLFSlideShow(dirA, fs);
    ppe = new PowerPointExtractor(ss);
    assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
View Full Code Here

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

      POIFSFileSystem fs = new POIFSFileSystem(
          new FileInputStream(filename3)
      );
      HSLFSlideShow ss;
     
      DirectoryNode dirA = (DirectoryNode)
        fs.getRoot().getEntry("MBD0000A3B6");
    DirectoryNode dirB = (DirectoryNode)
      fs.getRoot().getEntry("MBD0000A3B3");
   
    assertNotNull(dirA.getEntry("PowerPoint Document"));
    assertNotNull(dirB.getEntry("PowerPoint Document"));
     
    // Check the first file
      ss = new HSLFSlideShow(dirA, fs);
    ppe = new PowerPointExtractor(ss);
    assertEquals("Sample PowerPoint file\nThis is the 1st file\nNot much too it\n",
View Full Code Here

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

    protected boolean processOle2( HWPFDocument wordDocument, Element block,
            Entry entry ) throws Exception
    {
        if ( !( entry instanceof DirectoryNode ) )
            return false;
        DirectoryNode directoryNode = (DirectoryNode) entry;

        /*
         * even if there is no ExtractorFactory in classpath, still support
         * included Word's objects
         */
        if ( directoryNode.hasEntry( "WordDocument" ) )
        {
            String text = WordToTextConverter.getText( (DirectoryNode) entry );
            block.appendChild( textDocumentFacade
                    .createText( UNICODECHAR_ZERO_WIDTH_SPACE + text
                            + UNICODECHAR_ZERO_WIDTH_SPACE ) );
View Full Code Here

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

      return olemap;
    }
   
    public int addOlePackage(POIFSFileSystem poiData, String label, String fileName, String command)
    throws IOException {
      DirectoryNode root = poiData.getRoot();
      Map<String,ClassID> olemap = getOleMap();
      for (Map.Entry<String,ClassID> entry : olemap.entrySet()) {
        if (root.hasEntry(entry.getKey())) {
          root.setStorageClsid(entry.getValue());
          break;
        }
      }
     
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
View Full Code Here

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

              for (int i = 0; i < objects.size(); i++) {
                 HSSFObjectData embeddedObject = objects.get(i);
                 if (embeddedObject.hasDirectoryEntry()) {
                    DirectoryEntry dir = embeddedObject.getDirectory();
                    if (dir instanceof DirectoryNode) {
                       DirectoryNode dNode = (DirectoryNode)dir;
                       if (hasEntry(dNode,"WordDocument")) {
                          found = true;
                       }
                    }
                 }
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.