public String toString() { StringBuffer buffer = new StringBuffer(40 * (path.length() + 1)); for (int j = 0; j < path.length(); j++) { buffer.append(path.getComponent(j)).append("/"); } buffer.append(name); return buffer.toString(); } } // end public class DocumentDescriptor
public POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer) throws IOException { this._filesystem = filesystem; if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(filesystem); _block_size = _filesystem.getBlockStoreBlockSize(); } this._property = new DocumentProperty(name, size); _property.setStartBlock(_stream.getStartBlock()); _property.setDocument(this); try (DocumentOutputStream os = new DocumentOutputStream(this, size)) { POIFSDocumentPath path = new POIFSDocumentPath(name.split("\\\\")); String docName = path.getComponent(path.length() - 1); POIFSWriterEvent event = new POIFSWriterEvent(os, path, docName, size); writer.processPOIFSWriterEvent(event); } }
/** * equality. Two DocumentDescriptor instances are equal if they * have equal paths and names * * @param o the object we're checking equality for * * @return true if the object is equal to this object */ public boolean equals(final Object o) { boolean rval = false; if ((o != null) && (o.getClass() == this.getClass())) { if (this == o) { rval = true; } else { DocumentDescriptor descriptor = ( DocumentDescriptor ) o; rval = this.path.equals(descriptor.path) && this.name.equals(descriptor.name); } } return rval; }
if (path.length() == 0) final String name = path.getComponent(path.length() - 1); final POIFSDocumentPath parentPath = path.getParent(); final MutableTreeNode parentNode = getNode(parentPath, fsName, root);
try { final String s = path.toString(); DirectoryEntry de = paths.get(s); if (de != null) int l = path.length(); if (l == 0) { de = getPath(poiFs, path.getParent()); de = de.createDirectory(path.getComponent (path.length() - 1));
/** * <p>Returns the path's parent or <code>null</code> if this path * is the root path.</p> * * @since 2002-01-24 * @return path of parent, or null if this path is the root path */ public POIFSDocumentPath getParent() { final int length = components.length - 1; if (length < 0) { return null; } String[] parentComponents = new String[ length ]; System.arraycopy(components, 0, parentComponents, 0, length); return new POIFSDocumentPath(parentComponents); }
/** * calculate and return the hashcode * * @return hashcode */ public int hashCode() { if (hashcode == 0) { hashcode = path.hashCode() ^ name.hashCode(); } return hashcode; }
event.getName() + " in " + event.getPath().toString()); t.printStackTrace(System.err); throw new RuntimeException(t.getMessage());
/** * calculate and return the hashcode * * @return hashcode */ public int hashCode() { if (hashcode == 0) { hashcode = computeHashCode(); } return hashcode; }
if (path.length() == 0) final String name = path.getComponent(path.length() - 1); final POIFSDocumentPath parentPath = path.getParent(); final MutableTreeNode parentNode = getNode(parentPath, fsName, root);
final String s = path.toString(); DirectoryEntry de = paths.get(s); if (de != null) int l = path.length(); if (l == 0) de = getPath(poiFs, path.getParent()); de = de.createDirectory(path.getComponent (path.length() - 1));
/** * Register a POIFSReaderListener for a document in the specified * directory * * @param listener the listener to be registered * @param path the document path; if null, the root directory is * assumed * @param name the document name * * @exception NullPointerException if listener is null or name is * null or empty * @exception IllegalStateException if read() has already been * called */ public void registerListener(final POIFSReaderListener listener, final POIFSDocumentPath path, final String name) { if ((listener == null) || (name == null) || (name.length() == 0)) { throw new NullPointerException(); } if (registryClosed) { throw new IllegalStateException(); } registry.registerListener(listener, (path == null) ? new POIFSDocumentPath() : path, name); }
/** * calculate and return the hashcode * * @return hashcode */ public int hashCode() { if (hashcode == 0) { hashcode = path.hashCode() ^ name.hashCode(); } return hashcode; }
event.getName() + " in " + event.getPath().toString()); t.printStackTrace(System.err); throw new RuntimeException(t.getMessage());
/** * calculate and return the hashcode * * @return hashcode */ public int hashCode() { if (hashcode == 0) { hashcode = computeHashCode(); } return hashcode; }
/** * <p>Returns a string representation of the path. Components are * separated by the platform-specific file separator {@link File#separatorChar}</p> * * @return string representation * * @since 2002-01-24 */ public String toString() { final StringBuffer b = new StringBuffer(); final int l = length(); b.append(File.separatorChar); for (int i = 0; i < l; i++) { b.append(getComponent(i)); if (i < l - 1) { b.append(File.separatorChar); } } return b.toString(); } } // end public class POIFSDocumentPath
if (path.length() == 0) final String name = path.getComponent(path.length() - 1); final POIFSDocumentPath parentPath = path.getParent(); final MutableTreeNode parentNode = getNode(parentPath, fsName, root);
public POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer) throws IOException { this._filesystem = filesystem; if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(filesystem); _block_size = _filesystem.getBlockStoreBlockSize(); } this._property = new DocumentProperty(name, size); _property.setStartBlock(_stream.getStartBlock()); _property.setDocument(this); try (DocumentOutputStream os = new DocumentOutputStream(this, size)) { POIFSDocumentPath path = new POIFSDocumentPath(name.split("\\\\")); String docName = path.getComponent(path.length() - 1); POIFSWriterEvent event = new POIFSWriterEvent(os, path, docName, size); writer.processPOIFSWriterEvent(event); } }
/** * Read from a NPOIFSFileSystem and process the documents we get * * @param poifs the NPOIFSFileSystem from which to read the data * * @exception IOException on errors reading, or on invalid data */ public void read(final POIFSFileSystem poifs) throws IOException { registryClosed = true; // get property table from the document PropertyTable properties = poifs.getPropertyTable(); // process documents RootProperty root = properties.getRoot(); processProperties(poifs, root, new POIFSDocumentPath()); }
/** * calculate and return the hashcode * * @return hashcode */ public int hashCode() { if (hashcode == 0) { hashcode = path.hashCode() ^ name.hashCode(); } return hashcode; }