public static void compare ( final IFileContentResultBean fileContentResultBean , final boolean ignoreAbsolutePathEquality , final boolean ignoreExtensionEquality , final boolean ignoreLengthEquality , final boolean ignoreLastModified , final boolean ignoreNameEquality , final boolean ignoreContentEquality ) { compare ( fileContentResultBean , ignoreAbsolutePathEquality , ignoreExtensionEquality , ignoreLengthEquality , ignoreLastModified , ignoreNameEquality ) ; final File source = fileContentResultBean . getSourceFile ( ) ; final File compare = fileContentResultBean . getFileToCompare ( ) ; if ( ! ignoreContentEquality ) { boolean contentEquality ; try { final String sourceChecksum = ChecksumExtensions . getChecksum ( source , HashAlgorithm . SHA_512 . getAlgorithm ( ) ) ; final String compareChecksum = ChecksumExtensions . getChecksum ( compare , HashAlgorithm . SHA_512 . getAlgorithm ( ) ) ; contentEquality = sourceChecksum . equals ( compareChecksum ) ; fileContentResultBean . setContentEquality ( contentEquality ) ; } catch ( final NoSuchAlgorithmException e ) { // if the algorithm is not supported check it with CRC32. try { contentEquality = ChecksumExtensions . getCheckSumCRC32 ( source ) == ChecksumExtensions . getCheckSumCRC32 ( compare ) ; fileContentResultBean . setContentEquality ( contentEquality ) ; } catch ( IOException e1 ) { fileContentResultBean . setContentEquality ( false ) ; } } catch ( IOException e ) { fileContentResultBean . setContentEquality ( false ) ; } } else { fileContentResultBean . setContentEquality ( true ) ; } }
Sets the flags in the FileContentResultBean object according to the given boolean flag what to ignore .