Class Compare

java.lang.Object
com.basis.filesystem.Compare

public final class Compare extends Object
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 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

      public static void main(String... args)
      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

      public static String bytesToString(byte[] p_bytes, int p_offset, int p_length)