/** * Copies all the nodes from one POIFS Directory to another * * @param sourceRoot * is the source Directory to copy from * @param targetRoot * is the target Directory to copy to */ public static void copyNodes(DirectoryEntry sourceRoot, DirectoryEntry targetRoot) throws IOException { for (Entry entry : sourceRoot) { copyNodeRecursively( entry, targetRoot ); } }
/** * Copies all nodes from one POIFS to the other * * @param source * is the source POIFS to copy from * @param target * is the target POIFS to copy to */ public static void copyNodes(POIFSFileSystem source, POIFSFileSystem target ) throws IOException { copyNodes( source.getRoot(), target.getRoot() ); }
boolean match; if (a.isDirectoryEntry()) { match = areDirectoriesIdentical( (DirectoryEntry)a, (DirectoryEntry)b); } else { match = areDocumentsIdentical( (DocumentEntry)a, (DocumentEntry)b);
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; }
boolean match; if (a.isDirectoryEntry()) { match = areDirectoriesIdentical( (DirectoryEntry)a, (DirectoryEntry)b); } else { match = areDocumentsIdentical( (DocumentEntry)a, (DocumentEntry)b);
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 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 an Entry into a target POIFS directory, recursively */ @Internal public static void copyNodeRecursively( Entry entry, DirectoryEntry target ) throws IOException { if ( entry.isDirectoryEntry() ) { DirectoryEntry dirEntry = (DirectoryEntry)entry; DirectoryEntry newTarget = target.createDirectory( entry.getName() ); newTarget.setStorageClsid( dirEntry.getStorageClsid() ); Iterator<Entry> entries = dirEntry.getEntries(); while ( entries.hasNext() ) { copyNodeRecursively( entries.next(), newTarget ); } } else { DocumentEntry dentry = (DocumentEntry) entry; DocumentInputStream dstream = new DocumentInputStream( dentry ); target.createDocument( dentry.getName(), dstream ); dstream.close(); } }
final DirectoryEntry oRoot = opfs.getRoot(); final DirectoryEntry cRoot = cpfs.getRoot(); System.out.println(EntryUtils.areDirectoriesIdentical(oRoot, cRoot) ? "Equal" : "Not equal");
/** * 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 all the nodes from one POIFS Directory to another * * @param sourceRoot * is the source Directory to copy from * @param targetRoot * is the target Directory to copy to */ public static void copyNodes(DirectoryEntry sourceRoot, DirectoryEntry targetRoot) throws IOException { for (Entry entry : sourceRoot) { copyNodeRecursively( entry, targetRoot ); } }
EntryUtils.copyNodes( new FilteringDirectoryNode(getDirectory(), excepts) , new FilteringDirectoryNode(fs.getRoot(), excepts)
/** * Copies all the nodes from one POIFS Directory to another * * @param sourceRoot * is the source Directory to copy from * @param targetRoot * is the target Directory to copy to */ public static void copyNodes(DirectoryEntry sourceRoot, DirectoryEntry targetRoot) throws IOException { for (Entry entry : sourceRoot) { copyNodeRecursively( entry, targetRoot ); } }
/** * Copies nodes from one Directory to the other minus the excepts * * @param filteredSource The filtering source Directory to copy from * @param filteredTarget The filtering target Directory to copy to */ public static void copyNodes( FilteringDirectoryNode filteredSource, FilteringDirectoryNode filteredTarget ) throws IOException { // Nothing special here, just overloaded types to make the // recommended new way to handle this clearer copyNodes( (DirectoryEntry)filteredSource, (DirectoryEntry)filteredTarget ); }
/** * Copies all the nodes from one POIFS Directory to another * * @param sourceRoot * is the source Directory to copy from * @param targetRoot * is the target Directory to copy to */ public static void copyNodes(DirectoryEntry sourceRoot, DirectoryEntry targetRoot) throws IOException { for (Entry entry : sourceRoot) { copyNodeRecursively( entry, targetRoot ); } }
/** * Copies nodes from one Directory to the other minus the excepts * * @param filteredSource The filtering source Directory to copy from * @param filteredTarget The filtering target Directory to copy to */ public static void copyNodes( FilteringDirectoryNode filteredSource, FilteringDirectoryNode filteredTarget ) throws IOException { // Nothing special here, just overloaded types to make the // recommended new way to handle this clearer copyNodes( (DirectoryEntry)filteredSource, (DirectoryEntry)filteredTarget ); }
@Internal public void writeTo( DirectoryEntry directoryEntry ) throws IOException { if ( _objectPool != null ) EntryUtils.copyNodeRecursively( _objectPool, directoryEntry ); } }
/** * Copies nodes from one POIFS to the other minus the excepts * @param source is the source POIFS to copy from * @param target is the target POIFS to copy to * @param excepts is a list of Strings specifying what nodes NOT to copy */ @Deprecated protected void copyNodes( POIFSFileSystem source, POIFSFileSystem target, List<String> excepts ) throws IOException { EntryUtils.copyNodes( source, target, excepts ); }
/** * Copies an Entry into a target POIFS directory, recursively */ @Internal @Deprecated protected void copyNodeRecursively( Entry entry, DirectoryEntry target ) throws IOException { EntryUtils.copyNodeRecursively( entry, target ); } }
/** * Copies nodes from one POIFS to the other minus the excepts * @param source is the source POIFS to copy from * @param target is the target POIFS to copy to * @param excepts is a list of Strings specifying what nodes NOT to copy */ @Deprecated protected void copyNodes( POIFSFileSystem source, POIFSFileSystem target, List<String> excepts ) throws IOException { EntryUtils.copyNodes( source, target, excepts ); }