Examples of DirectoryEntry


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

        {
            try
            {
                /* Check whether this directory has already been created. */
                final String s = path.toString();
                DirectoryEntry de = (DirectoryEntry) paths.get(s);
                if (de != null)
                    /* Yes: return the corresponding DirectoryEntry. */
                    return de;

                /* No: We have to create the directory - or return the root's
                 * DirectoryEntry. */
                int l = path.length();
                if (l == 0)
                    /* Get the root directory. It does not have to be created
                     * since it always exists in a POIFS. */
                    de = poiFs.getRoot();
                else
                {
                    /* Create a subordinate directory. The first step is to
                     * ensure that the parent directory exists: */
                    de = getPath(poiFs, path.getParent());
                    /* Now create the target directory: */
                    de = de.createDirectory(path.getComponent
                                            (path.length() - 1));
                }
                paths.put(s, de);
                return de;
            }
View Full Code Here

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

        final POIFSFileSystem opfs =
            new POIFSFileSystem(new FileInputStream(originalFileName));
        final POIFSFileSystem cpfs =
            new POIFSFileSystem(new FileInputStream(copyFileName));

        final DirectoryEntry oRoot = opfs.getRoot();
        final DirectoryEntry cRoot = cpfs.getRoot();
        final StringBuffer messages = new StringBuffer();
        if (equal(oRoot, cRoot, messages))
            System.out.println("Equal");
        else
            System.out.println("Not equal: " + messages.toString());
View Full Code Here

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

                         final POIFSDocumentPath path,
                         final String name,
                         final PropertySet ps)
            throws WritingNotSupportedException, IOException
        {
            final DirectoryEntry de = getPath(poiFs, path);
            final MutablePropertySet mps = new MutablePropertySet(ps);
            de.createDocument(name, mps.toInputStream());
        }
View Full Code Here

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

        public void copy(final POIFSFileSystem poiFs,
                         final POIFSDocumentPath path,
                         final String name,
                         final DocumentInputStream stream) throws IOException
        {
            final DirectoryEntry de = getPath(poiFs, path);
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            int c;
            while ((c = stream.read()) != -1)
                out.write(c);
            stream.close();
            out.close();
            final InputStream in =
                new ByteArrayInputStream(out.toByteArray());
            de.createDocument(name, in);
        }
View Full Code Here

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

        {
            try
            {
                /* Check whether this directory has already been created. */
                final String s = path.toString();
                DirectoryEntry de = (DirectoryEntry) paths.get(s);
                if (de != null)
                    /* Yes: return the corresponding DirectoryEntry. */
                    return de;

                /* No: We have to create the directory - or return the root's
                 * DirectoryEntry. */
                int l = path.length();
                if (l == 0)
                    /* Get the root directory. It does not have to be created
                     * since it always exists in a POIFS. */
                    de = poiFs.getRoot();
                else
                {
                    /* Create a subordinate directory. The first step is to
                     * ensure that the parent directory exists: */
                    de = getPath(poiFs, path.getParent());
                    /* Now create the target directory: */
                    de = de.createDirectory(path.getComponent
                                            (path.length() - 1));
                }
                paths.put(s, de);
                return de;
            }
View Full Code Here

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

        protected void copy(DirectoryEntry sourceDir, DirectoryEntry destDir)
                throws IOException {
            for (org.apache.poi.poifs.filesystem.Entry entry : sourceDir) {
                if (entry instanceof DirectoryEntry) {
                    // Need to recurse
                    DirectoryEntry newDir = destDir.createDirectory(entry.getName());
                    copy((DirectoryEntry) entry, newDir);
                } else {
                    // Copy entry
                    InputStream contents = new DocumentInputStream((DocumentEntry) entry);
                    try {
View Full Code Here

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

           p = pictures.nextUnclaimed();
        }
       
        // Handle any embeded office documents
        try {
            DirectoryEntry op = (DirectoryEntry) root.getEntry("ObjectPool");
            for (Entry entry : op) {
                if (entry.getName().startsWith("_")
                        && entry instanceof DirectoryEntry) {
                    handleEmbeddedOfficeDoc((DirectoryEntry) entry, xhtml);
                }
View Full Code Here

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

    protected void copy(DirectoryEntry sourceDir, DirectoryEntry destDir)
            throws IOException {
      for (Entry entry : sourceDir) {
        if (entry instanceof DirectoryEntry) {
          // Need to recurse
          DirectoryEntry newDir = destDir.createDirectory(entry.getName());
          copy((DirectoryEntry) entry, newDir);
        } else {
          // Copy entry
          InputStream contents = new DocumentInputStream((DocumentEntry) entry);
          try {
View Full Code Here

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

        }
      }
    } 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);
          }
View Full Code Here

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

        {
            final File doc = docs[i];

            /* Read a test document <em>doc</em> into a POI filesystem. */
            final POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(doc));
            final DirectoryEntry dir = poifs.getRoot();
            DocumentEntry dsiEntry = null;
            try
            {
                dsiEntry = (DocumentEntry) dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
            }
            catch (FileNotFoundException ex)
            {
                /*
                 * A missing document summary information stream is not an error
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.