private Entry wrapEntry(Entry entry) { String name = entry.getName(); if (childExcludes.containsKey(name) && entry instanceof DirectoryEntry) { return new FilteringDirectoryNode( (DirectoryEntry)entry, childExcludes.get(name)); } return entry; }
public Iterator<Entry> iterator() { return getEntries(); }
public boolean isEmpty() { return (getEntryCount() == 0); }
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
private void write(POIFSFileSystem fs) throws IOException { // For tracking what we've written out, so far List<String> excepts = new ArrayList<>(2); // Write out our HPFS properties, with any changes writeProperties(fs, excepts); // Copy over everything else unchanged FilteringDirectoryNode src = new FilteringDirectoryNode(getDirectory(), excepts); FilteringDirectoryNode dest = new FilteringDirectoryNode(fs.getRoot(), excepts); EntryUtils.copyNodes(src, dest); // Caller will save the resultant POIFSFileSystem to the stream/file } }
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
public Iterator<Entry> iterator() { return getEntries(); }
public boolean isEmpty() { return (getEntryCount() == 0); }
/** * Copies nodes from one POIFS to the other, minus the excepts. * This delegates the filtering work to {@link FilteringDirectoryNode}, * so excepts can be of the form "NodeToExclude" or * "FilteringDirectory/ExcludedChildNode" * * @param source is the source POIFS to copy from * @param target is the target POIFS to copy to * @param excepts is a list of Entry Names to be excluded from the copy */ public static void copyNodes(POIFSFileSystem source, POIFSFileSystem target, List<String> excepts ) throws IOException { copyNodes( new FilteringDirectoryNode(source.getRoot(), excepts), new FilteringDirectoryNode(target.getRoot(), excepts) ); }
public Entry getEntry(String name) throws FileNotFoundException { if (excludes.contains(name)) { throw new FileNotFoundException(name); } Entry entry = directory.getEntry(name); return wrapEntry(entry); } private Entry wrapEntry(Entry entry) {
public Iterator<Entry> iterator() { return getEntries(); }
public boolean isEmpty() { return (getEntryCount() == 0); }
new FilteringDirectoryNode(getDirectory(), excepts) , new FilteringDirectoryNode(fs.getRoot(), excepts) );
public Iterator<Entry> iterator() { return getEntries(); }
public boolean isEmpty() { return (getEntryCount() == 0); }
private Entry wrapEntry(Entry entry) { String name = entry.getName(); if (childExcludes.containsKey(name) && entry instanceof DirectoryEntry) { return new FilteringDirectoryNode( (DirectoryEntry)entry, childExcludes.get(name)); } return entry; }
private Entry wrapEntry(Entry entry) { String name = entry.getName(); if (childExcludes.containsKey(name) && entry instanceof DirectoryEntry) { return new FilteringDirectoryNode( (DirectoryEntry)entry, childExcludes.get(name)); } return entry; }
private Entry wrapEntry(Entry entry) { String name = entry.getName(); if (childExcludes.containsKey(name) && entry instanceof DirectoryEntry) { return new FilteringDirectoryNode( (DirectoryEntry)entry, childExcludes.get(name)); } return entry; }
private boolean isContentIdentical(NPOIFSFileSystem fs1, NPOIFSFileSystem fs2, Collection<String> excludes) throws IOException { DirectoryEntry de1 = fs1.getRoot(); DirectoryEntry de2 = fs2.getRoot(); FilteringDirectoryNode fs1Filtered = new FilteringDirectoryNode(de1, excludes); FilteringDirectoryNode fs2Filtered = new FilteringDirectoryNode(de2, excludes); boolean retVal = EntryUtils.areDirectoriesIdentical(fs1Filtered, fs2Filtered); if(logger.isDebugEnabled()) { logger.debug("returning equal="+ retVal); } return retVal; }