@Test public void testGetChecksumFile() { ChecksummedFile checksummedFile = new ChecksummedFile( Paths.get( "test.jar" ) ); Assert.assertEquals( "test.jar.sha1", checksummedFile.getChecksumFile( ChecksumAlgorithm.SHA1 ).getFileName().toString() ); }
public Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ) { for ( String ext : checksumAlgorithm.getExt( ) ) { Path file = referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + ext ); if ( Files.exists( file ) ) { return file; } } return referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + checksumAlgorithm.getDefaultExtension() ); }
ChecksummedFile { public Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ) { for ( String ext : checksumAlgorithm.getExt( ) ) { Path file = referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + ext ); if ( Files.exists( file ) ) { return file; } } return referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + checksumAlgorithm.getDefaultExtension() ); } }
ChecksummedFile { public Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ) { for ( String ext : checksumAlgorithm.getExt( ) ) { Path file = referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + ext ); if ( Files.exists( file ) ) { return file; } } return referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + checksumAlgorithm.getDefaultExtension() ); } ChecksummedFile( final Path referenceFile ); }
ChecksummedFile { public Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ) { for ( String ext : checksumAlgorithm.getExt( ) ) { Path file = referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + ext ); if ( Files.exists( file ) ) { return file; } } return referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + checksumAlgorithm.getDefaultExtension() ); } ChecksummedFile( final Path referenceFile ); static ChecksumReference getFromChecksumFile( Path checksumFile ); String calculateChecksum( ChecksumAlgorithm checksumAlgorithm ); Path writeFile(ChecksumAlgorithm checksumAlgorithm ); Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ); boolean isValidChecksum( ChecksumAlgorithm algorithm); boolean isValidChecksum( ChecksumAlgorithm algorithm, boolean throwExceptions ); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms, boolean throwExceptions); Path getReferenceFile( ); UpdateStatusList fixChecksum(ChecksumAlgorithm algorithm); UpdateStatusList fixChecksums( List<ChecksumAlgorithm> algorithms ); String parseChecksum( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, String fileName, Charset encoding ); ChecksumFileContent parseChecksumFile( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, Charset encoding ); }
ChecksummedFile { public Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ) { for ( String ext : checksumAlgorithm.getExt( ) ) { Path file = referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + ext ); if ( Files.exists( file ) ) { return file; } } return referenceFile.resolveSibling( referenceFile.getFileName( ) + "." + checksumAlgorithm.getDefaultExtension() ); } ChecksummedFile( final Path referenceFile ); static ChecksumReference getFromChecksumFile( Path checksumFile ); String calculateChecksum( ChecksumAlgorithm checksumAlgorithm ); Path writeFile(ChecksumAlgorithm checksumAlgorithm ); Path getChecksumFile( ChecksumAlgorithm checksumAlgorithm ); boolean isValidChecksum( ChecksumAlgorithm algorithm); boolean isValidChecksum( ChecksumAlgorithm algorithm, boolean throwExceptions ); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms); boolean isValidChecksums( List<ChecksumAlgorithm> algorithms, boolean throwExceptions); Path getReferenceFile( ); UpdateStatusList fixChecksum(ChecksumAlgorithm algorithm); UpdateStatusList fixChecksums( List<ChecksumAlgorithm> algorithms ); String parseChecksum( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, String fileName, Charset encoding ); ChecksumFileContent parseChecksumFile( Path checksumFile, ChecksumAlgorithm checksumAlgorithm, Charset encoding );  }