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; }
/** * 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) ); }
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 } }
new FilteringDirectoryNode(getDirectory(), excepts) , new FilteringDirectoryNode(fs.getRoot(), excepts) );
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; }
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; }
/** * 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) ); }
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 } }
/** * 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) ); }
/** * 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) ); }
new FilteringDirectoryNode(getDirectory(), excepts) , new FilteringDirectoryNode(fs.getRoot(), excepts) );