Package io.github.astrapi69.file.compare
Class SimpleCompareFileExtensions
java.lang.Object
io.github.astrapi69.file.compare.SimpleCompareFileExtensions
The class
SimpleCompareFileExtensions
.-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
compareFilesByAbsolutePath
(File sourceFile, File fileToCompare) Compare files by absolute path.static boolean
compareFilesByChecksum
(File sourceFile, File fileToCompare, io.github.astrapi69.crypt.api.algorithm.Algorithm algorithm) Compare files by checksum with the algorithm Adler32.static boolean
compareFilesByChecksumAdler32
(File sourceFile, File fileToCompare) Compare files by checksum with the algorithm Adler32.static boolean
compareFilesByChecksumCRC32
(File sourceFile, File fileToCompare) Compare files by checksum with the algorithm CRC32.static boolean
compareFilesByContent
(File sourceFile, File fileToCompare) Compare files by content.static boolean
compareFilesByExtension
(File sourceFile, File fileToCompare) Compare files by extension.static boolean
compareFilesByLastModified
(File sourceFile, File fileToCompare) Compare files by last modified.static boolean
compareFilesByLength
(File sourceFile, File fileToCompare) Compare files by length.static boolean
compareFilesByName
(File sourceFile, File fileToCompare) Compare files by name.
-
Method Details
-
compareFilesByAbsolutePath
Compare files by absolute path.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the absolute path are equal, otherwise false.
-
compareFilesByChecksum
public static boolean compareFilesByChecksum(File sourceFile, File fileToCompare, io.github.astrapi69.crypt.api.algorithm.Algorithm algorithm) throws NoSuchAlgorithmException, IOException Compare files by checksum with the algorithm Adler32.- Parameters:
sourceFile
- the source filefileToCompare
- the file to comparealgorithm
- the algorithm- Returns:
- true if the checksum with the algorithm Adler32 are equal, otherwise false.
- Throws:
NoSuchAlgorithmException
- Is thrown if the algorithm is not supported or does not exists.IOException
- Signals that an I/O exception has occurred.
-
compareFilesByChecksumAdler32
public static boolean compareFilesByChecksumAdler32(File sourceFile, File fileToCompare) throws IOException Compare files by checksum with the algorithm Adler32.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the checksum with the algorithm Adler32 are equal, otherwise false.
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
compareFilesByChecksumCRC32
public static boolean compareFilesByChecksumCRC32(File sourceFile, File fileToCompare) throws IOException Compare files by checksum with the algorithm CRC32.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the checksum with the algorithm CRC32 are equal, otherwise false.
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
compareFilesByContent
Compare files by content.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the content are equal, otherwise false.
-
compareFilesByExtension
Compare files by extension.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the extension are equal, otherwise false.
-
compareFilesByLastModified
Compare files by last modified.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the last modified are equal, otherwise false.
-
compareFilesByLength
Compare files by length.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the length are equal, otherwise false.
-
compareFilesByName
Compare files by name.- Parameters:
sourceFile
- the source filefileToCompare
- the file to compare- Returns:
- true if the name are equal, otherwise false.
-