Package org.apache.poi.poifs.filesystem

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


    throws WritingNotSupportedException, IOException
    {
        /* If there is already an entry with the same name, remove it. */
        try
        {
            final Entry e = dir.getEntry(name);
            e.delete();
        }
        catch (FileNotFoundException ex)
        {
            /* Entry not found, no need to remove it. */
        }
View Full Code Here


    DirectoryEntry newRoot = target.getRoot();

    Iterator entries = root.getEntries();

    while (entries.hasNext()) {
      Entry entry = (Entry)entries.next();
      if (!isInList(entry.getName(), excepts)) {
        copyNodeRecursively(entry,newRoot);
      }
    }
  }
View Full Code Here

  }
  public static POIOLE2TextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
    // Look for certain entries in the stream, to figure it
    //  out from
    for(Iterator entries = poifsDir.getEntries(); entries.hasNext(); ) {
      Entry entry = (Entry)entries.next();
     
      if(entry.getName().equals("Workbook")) {
        return new ExcelExtractor(poifsDir, fs);
      }
      if(entry.getName().equals("WordDocument")) {
        return new WordExtractor(poifsDir, fs);
      }
      if(entry.getName().equals("PowerPoint Document")) {
        return new PowerPointExtractor(poifsDir, fs);
      }
      if(entry.getName().equals("VisioDocument")) {
        return new VisioTextExtractor(poifsDir, fs);
      }
    }
    throw new IllegalArgumentException("No supported documents found in the OLE2 stream");
  }
View Full Code Here

   
    if(ext instanceof ExcelExtractor) {
      // These are in MBD... under the root
      Iterator it = fs.getRoot().getEntries();
      while(it.hasNext()) {
        Entry entry = (Entry)it.next();
        if(entry.getName().startsWith("MBD")) {
          dirs.add(entry);
        }
      }
    } else if(ext instanceof WordExtractor) {
      // These are in ObjectPool -> _... under the root
      try {
        DirectoryEntry op = (DirectoryEntry)
          fs.getRoot().getEntry("ObjectPool");
        Iterator it = op.getEntries();
        while(it.hasNext()) {
          Entry entry = (Entry)it.next();
          if(entry.getName().startsWith("_")) {
            dirs.add(entry);
          }
        }
      } catch(FileNotFoundException e) {}
    } else if(ext instanceof PowerPointExtractor) {
View Full Code Here

            } else {
                if(obj.hasDirectoryEntry()){
                    // The DirectoryEntry is a DocumentNode. Examine its entries to find out what it is
                    DirectoryNode dn = (DirectoryNode) obj.getDirectory();
                    for (Iterator entries = dn.getEntries(); entries.hasNext();) {
                        Entry entry = (Entry) entries.next();
                        //System.out.println(oleName + "." + entry.getName());
                    }
                } else {
                    // There is no DirectoryEntry
                    // Recover the object’s data from the HSSFObjectData instance.
View Full Code Here

  }
  public static POIOLE2TextExtractor createExtractor(DirectoryNode poifsDir, POIFSFileSystem fs) throws IOException {
    // Look for certain entries in the stream, to figure it
    //  out from
    for(Iterator<Entry> entries = poifsDir.getEntries(); entries.hasNext(); ) {
      Entry entry = entries.next();
     
      if(entry.getName().equals("Workbook")) {
         if(getPreferEventExtractor()) {
               return new EventBasedExcelExtractor(poifsDir, fs);
         } else {
            return new ExcelExtractor(poifsDir, fs);
         }
      }
      if(entry.getName().equals("WordDocument")) {
        return new WordExtractor(poifsDir, fs);
      }
      if(entry.getName().equals("PowerPoint Document")) {
        return new PowerPointExtractor(poifsDir, fs);
      }
      if(entry.getName().equals("VisioDocument")) {
        return new VisioTextExtractor(poifsDir, fs);
      }
         if(entry.getName().equals("Quill")) {
            return new PublisherTextExtractor(poifsDir, fs);
         }
      if(
            entry.getName().equals("__substg1.0_1000001E") ||
               entry.getName().equals("__substg1.0_1000001F") ||
            entry.getName().equals("__substg1.0_0047001E") ||
               entry.getName().equals("__substg1.0_0047001F") ||
            entry.getName().equals("__substg1.0_0037001E") ||
               entry.getName().equals("__substg1.0_0037001F")
      ) {
         return new OutlookTextExtactor(poifsDir, fs);
      }
    }
    throw new IllegalArgumentException("No supported documents found in the OLE2 stream");
View Full Code Here

   
    if(ext instanceof ExcelExtractor) {
      // These are in MBD... under the root
      Iterator<Entry> it = fs.getRoot().getEntries();
      while(it.hasNext()) {
        Entry entry = it.next();
        if(entry.getName().startsWith("MBD")) {
          dirs.add(entry);
        }
      }
    } else if(ext instanceof WordExtractor) {
      // These are in ObjectPool -> _... under the root
      try {
        DirectoryEntry op = (DirectoryEntry)
          fs.getRoot().getEntry("ObjectPool");
        Iterator<Entry> it = op.getEntries();
        while(it.hasNext()) {
          Entry entry = it.next();
          if(entry.getName().startsWith("_")) {
            dirs.add(entry);
          }
        }
      } catch(FileNotFoundException e) {}
    } else if(ext instanceof PowerPointExtractor) {
View Full Code Here

      DirectoryEntry newRoot = target.getRoot();

      Iterator entries = root.getEntries();

      while (entries.hasNext()) {
         Entry entry = (Entry)entries.next();
         if (!isInList(entry.getName(), excepts)) {
             copyNodeRecursively(entry,newRoot);
         }
      }
   }
View Full Code Here

        xhtml.startDocument();

        POIFSFileSystem filesystem = new POIFSFileSystem(stream);
        Iterator<?> entries = filesystem.getRoot().getEntries();
        while (entries.hasNext()) {
            Entry entry = (Entry) entries.next();
            String name = entry.getName();
            if (!(entry instanceof DocumentEntry)) {
                // Skip directory entries
            } else if (SUMMARY_INFORMATION.equals(name)
                    || DOCUMENT_SUMMARY_INFORMATION.equals(name)) {
                parse((DocumentEntry) entry, metadata);
View Full Code Here

    throws WritingNotSupportedException, IOException
    {
        /* If there is already an entry with the same name, remove it. */
        try
        {
            final Entry e = dir.getEntry(name);
            e.delete();
        }
        catch (FileNotFoundException ex)
        {
            /* Entry not found, no need to remove it. */
        }
View Full Code Here

TOP

Related Classes of org.apache.poi.poifs.filesystem.Entry

Copyright © 2018 www.massapicom. 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.