de.innovationgate.utils
public class DirComparer extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DirComparer.Diff
A difference between compared files
|
Constructor and Description |
---|
DirComparer()
Creates a comparer without filtering
|
DirComparer(org.apache.commons.vfs2.FileSelector fileSelector)
Creates a comparer which uses only files accepted by the parameter selector
|
Modifier and Type | Method and Description |
---|---|
boolean |
areEqual(org.apache.commons.vfs2.FileObject file1,
org.apache.commons.vfs2.FileObject file2)
Compares to files/folders for equality
|
java.util.Map<java.lang.String,DirComparer.Diff> |
determineDifferences(org.apache.commons.vfs2.FileObject file1,
org.apache.commons.vfs2.FileObject file2)
Returns the differences between two files/folders
|
java.util.Map<java.lang.String,java.lang.String> |
readFileHashes(org.apache.commons.vfs2.FileObject file)
Creates a map of hashes of all files contained in the given directory (or a map of a single hash for a given regular file).
|
public DirComparer()
public DirComparer(org.apache.commons.vfs2.FileSelector fileSelector)
fileSelector
- The selector to usepublic java.util.Map<java.lang.String,java.lang.String> readFileHashes(org.apache.commons.vfs2.FileObject file) throws java.security.NoSuchAlgorithmException, java.io.IOException
file
- java.security.NoSuchAlgorithmException
java.io.IOException
public boolean areEqual(org.apache.commons.vfs2.FileObject file1, org.apache.commons.vfs2.FileObject file2) throws java.security.NoSuchAlgorithmException, java.io.IOException
file1
- file2
- java.security.NoSuchAlgorithmException
java.io.IOException
public java.util.Map<java.lang.String,DirComparer.Diff> determineDifferences(org.apache.commons.vfs2.FileObject file1, org.apache.commons.vfs2.FileObject file2) throws java.security.NoSuchAlgorithmException, java.io.IOException
file1
- File 1file2
- File 2DirComparer.Diff
objects, representing files that differ, keyed by their pathjava.security.NoSuchAlgorithmException
java.io.IOException