Package org.cdlib.mrt.utility
Class MessageDigestValue
java.lang.Object
org.cdlib.mrt.utility.MessageDigestValue
- Direct Known Subclasses:
FixityTests
Perform Fixity tests
- Author:
- dloy
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMessageDigestValue(File file, String checksumTypeS, LoggerInf inLogger) Constructur - primary form Performs checksum creation on file and extacts file sizeMessageDigestValue(InputStream inputStream, String checksumTypeS, LoggerInf inLogger) Constructer - primary form Performs checksum creation on file and extacts file size -
Method Summary
Modifier and TypeMethodDescriptionDump the content of this object to a string for loggingprotected Stringformat entry for logstatic MessageDigestTypegetAlgorithm(String algorithmS) Convert a string form of checksum type to an enum form lowercase and strip punctuationreturn constructed hex checksumreturn constructed Bit 64 checksumstatic StringgetChecksumBit64(String checksumHex) return constructed Bit 64 checksumstatic StringgetCheckSumBit64(byte[] bytes) static StringgetChecksumHex(String checksumBit64) return hex checksum from Bit 64 checksumreturn constructed checksum typelongreturn match file sizeprotected TExceptionmakeTException(String header, Exception ex) protected voidsetSizeChecksum(InputStream inputStream, String checksumType) Get size and checksum for newer checksum typesprotected voidsetSizeChecksum32(Checksum checksum32, InputStream inputStream) Create checksums for older types: CRC32 and Adler32static byte[]static StringtoHexString(byte[] array)
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
BUFSIZE
protected static final int BUFSIZE- See Also:
-
DEBUG
protected static final boolean DEBUG- See Also:
-
checksum
-
checksumType
-
inputSize
protected long inputSize -
logger
-
-
Constructor Details
-
MessageDigestValue
Constructur - primary form Performs checksum creation on file and extacts file size- Parameters:
file- file used for fixity data creationinLogger-checksumType-- Throws:
TException
-
MessageDigestValue
public MessageDigestValue(InputStream inputStream, String checksumTypeS, LoggerInf inLogger) throws TException Constructer - primary form Performs checksum creation on file and extacts file size- Parameters:
inputStream- Input Stream from digital object for fixitychecksumTypeS- string form checksum typeinLogger- logger- Throws:
TException
-
-
Method Details
-
getAlgorithm
Convert a string form of checksum type to an enum form lowercase and strip punctuation- Parameters:
algorithmS- String form of checksum type- Returns:
-
dump
Dump the content of this object to a string for logging- Parameters:
header- header displayed in log entry
-
dumpEntry
format entry for log- Parameters:
key- format keyvalue- format value- Returns:
- formated key=value
-
getChecksum
return constructed hex checksum- Returns:
- checksum
-
getChecksumBit64
return constructed Bit 64 checksum- Returns:
- checksum
-
getChecksumBit64
return constructed Bit 64 checksum- Returns:
- checksum
-
getChecksumHex
return hex checksum from Bit 64 checksum- Returns:
- checksum
-
getCheckSumBit64
-
toHexString
-
toByteArray
-
getChecksumType
return constructed checksum type- Returns:
- checksumType
-
getChecksumJavaAlgorithm
-
getInputSize
public long getInputSize()return match file size- Returns:
- fileSize
-
setSizeChecksum
Get size and checksum for newer checksum types- Parameters:
inputStream- stream used for calculating checksumchecksumType- string form checksum type- Throws:
TException- process exception
-
setSizeChecksum32
Create checksums for older types: CRC32 and Adler32- Parameters:
checksum32- checksum handlerinputStream- stream used for checksum creation- Throws:
TException- process exception
-
makeTException
-
getResult
-