Class SimpleCompareFileExtensions

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean compareFilesByAbsolutePath​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by absolute path.
      static boolean compareFilesByChecksum​(java.io.File sourceFile, java.io.File fileToCompare, io.github.astrapi69.crypt.api.algorithm.Algorithm algorithm)
      Compare files by checksum with the algorithm Adler32.
      static boolean compareFilesByChecksumAdler32​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by checksum with the algorithm Adler32.
      static boolean compareFilesByChecksumCRC32​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by checksum with the algorithm CRC32.
      static boolean compareFilesByContent​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by content.
      static boolean compareFilesByExtension​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by extension.
      static boolean compareFilesByLastModified​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by last modified.
      static boolean compareFilesByLength​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by length.
      static boolean compareFilesByName​(java.io.File sourceFile, java.io.File fileToCompare)
      Compare files by name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • compareFilesByAbsolutePath

        public static boolean compareFilesByAbsolutePath​(java.io.File sourceFile,
                                                         java.io.File fileToCompare)
        Compare files by absolute path.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the absolute path are equal, otherwise false.
      • compareFilesByChecksum

        public static boolean compareFilesByChecksum​(java.io.File sourceFile,
                                                     java.io.File fileToCompare,
                                                     io.github.astrapi69.crypt.api.algorithm.Algorithm algorithm)
                                              throws java.security.NoSuchAlgorithmException,
                                                     java.io.IOException
        Compare files by checksum with the algorithm Adler32.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        algorithm - the algorithm
        Returns:
        true if the checksum with the algorithm Adler32 are equal, otherwise false.
        Throws:
        java.security.NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
        java.io.IOException - Signals that an I/O exception has occurred.
      • compareFilesByChecksumAdler32

        public static boolean compareFilesByChecksumAdler32​(java.io.File sourceFile,
                                                            java.io.File fileToCompare)
                                                     throws java.io.IOException
        Compare files by checksum with the algorithm Adler32.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the checksum with the algorithm Adler32 are equal, otherwise false.
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • compareFilesByChecksumCRC32

        public static boolean compareFilesByChecksumCRC32​(java.io.File sourceFile,
                                                          java.io.File fileToCompare)
                                                   throws java.io.IOException
        Compare files by checksum with the algorithm CRC32.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the checksum with the algorithm CRC32 are equal, otherwise false.
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • compareFilesByContent

        public static boolean compareFilesByContent​(java.io.File sourceFile,
                                                    java.io.File fileToCompare)
        Compare files by content.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the content are equal, otherwise false.
      • compareFilesByExtension

        public static boolean compareFilesByExtension​(java.io.File sourceFile,
                                                      java.io.File fileToCompare)
        Compare files by extension.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the extension are equal, otherwise false.
      • compareFilesByLastModified

        public static boolean compareFilesByLastModified​(java.io.File sourceFile,
                                                         java.io.File fileToCompare)
        Compare files by last modified.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the last modified are equal, otherwise false.
      • compareFilesByLength

        public static boolean compareFilesByLength​(java.io.File sourceFile,
                                                   java.io.File fileToCompare)
        Compare files by length.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the length are equal, otherwise false.
      • compareFilesByName

        public static boolean compareFilesByName​(java.io.File sourceFile,
                                                 java.io.File fileToCompare)
        Compare files by name.
        Parameters:
        sourceFile - the source file
        fileToCompare - the file to compare
        Returns:
        true if the name are equal, otherwise false.