Package com.basis.filesystem
Class Compare
java.lang.Object
com.basis.filesystem.Compare
Check two files for data equivalence. For string or program files this is
just checks byte equality, but for data files it just verifies the keys and
data are the same.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
bytesToString
(byte[] p_bytes, int p_offset, int p_length) static int
compare
(byte[] p_left, int p_leftOffset, int p_leftLength, byte[] p_right, int p_rightOffset, int p_rightLength) static boolean
compare
(ConnectionMgr p_mgr, String p_left, String p_right, boolean p_recursive, PrintWriter p_out) This method will compare the files/directories at the paths specified and return true if they are equivalent.static void
Main method so that this can be called from the command line.
-
Method Details
-
compare
public static boolean compare(ConnectionMgr p_mgr, String p_left, String p_right, boolean p_recursive, PrintWriter p_out) throws FilesystemException This method will compare the files/directories at the paths specified and return true if they are equivalent. If a PrintWriter is provided it will continue after the first difference and print the nature of the differences to the PrintWriter.- Parameters:
p_mgr
- ConnectionMgr to use opening files.p_left
- Left path.p_right
- Right path.p_recursive
- true if it should recursively compare directory contents.p_out
- Optional PrintWriter for difference details, if they are the same then nothing out output.- Returns:
- true if the files at the two paths are equivalent.
- Throws:
FilesystemException
-
main
Main method so that this can be called from the command line.- Parameters:
args
-
-
compare
public static int compare(byte[] p_left, int p_leftOffset, int p_leftLength, byte[] p_right, int p_rightOffset, int p_rightLength) -
bytesToString
-