|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.archiva.checksum.ChecksummedFile
public class ChecksummedFile
ChecksummedFile
Field Summary | |
---|---|
private org.slf4j.Logger |
log
|
private File |
referenceFile
|
Constructor Summary | |
---|---|
ChecksummedFile(File referenceFile)
Construct a ChecksummedFile object. |
Method Summary | |
---|---|
String |
calculateChecksum(ChecksumAlgorithm checksumAlgorithm)
Calculate the checksum based on a given checksum. |
File |
createChecksum(ChecksumAlgorithm checksumAlgorithm)
Creates a checksum file of the provided referenceFile. |
boolean |
fixChecksums(ChecksumAlgorithm[] algorithms)
Fix or create checksum files for the reference file. |
File |
getChecksumFile(ChecksumAlgorithm checksumAlgorithm)
Get the checksum file for the reference file and hash. |
boolean |
isValidChecksum(ChecksumAlgorithm algorithm)
Given a checksum file, check to see if the file it represents is valid according to the checksum. |
private boolean |
isValidChecksumPattern(String filename,
String path)
|
boolean |
isValidChecksums(ChecksumAlgorithm[] algorithms)
Of any checksum files present, validate that the reference file conforms the to the checksum. |
String |
parseChecksum(String rawChecksumString,
ChecksumAlgorithm expectedHash,
String expectedPath)
Parse a checksum string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.slf4j.Logger log
private final File referenceFile
Constructor Detail |
---|
public ChecksummedFile(File referenceFile)
referenceFile
- Method Detail |
---|
public String calculateChecksum(ChecksumAlgorithm checksumAlgorithm) throws IOException
checksumAlgorithm
- the algorithm to use.
IOException
- if unable to calculate the checksum.public File createChecksum(ChecksumAlgorithm checksumAlgorithm) throws IOException
checksumAlgorithm
- the hash to use.
IOException
- if there was a problem either reading the referenceFile, or writing the checksum file.public File getChecksumFile(ChecksumAlgorithm checksumAlgorithm)
checksumAlgorithm
- the hash that we are interested in.
public boolean isValidChecksum(ChecksumAlgorithm algorithm) throws IOException
Given a checksum file, check to see if the file it represents is valid according to the checksum.
NOTE: Only supports single file checksums of type MD5 or SHA1.
checksumFile
- the algorithms to check for.
IOException
- if the reading of the checksumFile or the file it refers to fails.public boolean isValidChecksums(ChecksumAlgorithm[] algorithms)
algorithms
- the algorithms to check for.
public boolean fixChecksums(ChecksumAlgorithm[] algorithms)
algorithms
- the hashes to check for.
private boolean isValidChecksumPattern(String filename, String path)
public String parseChecksum(String rawChecksumString, ChecksumAlgorithm expectedHash, String expectedPath) throws IOException
rawChecksumString
- expectedHash
- expectedPath
-
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |