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 SummaryNested Classes
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionMessageDigestValue(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 SummaryModifier 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:
 
- 
BUFSIZEprotected static final int BUFSIZE- See Also:
 
- 
DEBUGprotected static final boolean DEBUG- See Also:
 
- 
checksum
- 
checksumType
- 
inputSizeprotected long inputSize
- 
logger
 
- 
- 
Constructor Details- 
MessageDigestValueConstructur - primary form Performs checksum creation on file and extacts file size- Parameters:
- file- file used for fixity data creation
- inLogger-
- checksumType-
- Throws:
- TException
 
- 
MessageDigestValuepublic 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 fixity
- checksumTypeS- string form checksum type
- inLogger- logger
- Throws:
- TException
 
 
- 
- 
Method Details- 
getAlgorithmConvert a string form of checksum type to an enum form lowercase and strip punctuation- Parameters:
- algorithmS- String form of checksum type
- Returns:
 
- 
dumpDump the content of this object to a string for logging- Parameters:
- header- header displayed in log entry
 
- 
dumpEntryformat entry for log- Parameters:
- key- format key
- value- format value
- Returns:
- formated key=value
 
- 
getChecksumreturn constructed hex checksum- Returns:
- checksum
 
- 
getChecksumBit64return constructed Bit 64 checksum- Returns:
- checksum
 
- 
getChecksumBit64return constructed Bit 64 checksum- Returns:
- checksum
 
- 
getChecksumHexreturn hex checksum from Bit 64 checksum- Returns:
- checksum
 
- 
getCheckSumBit64
- 
toHexString
- 
toByteArray
- 
getChecksumTypereturn constructed checksum type- Returns:
- checksumType
 
- 
getChecksumJavaAlgorithm
- 
getInputSizepublic long getInputSize()return match file size- Returns:
- fileSize
 
- 
setSizeChecksumGet size and checksum for newer checksum types- Parameters:
- inputStream- stream used for calculating checksum
- checksumType- string form checksum type
- Throws:
- TException- process exception
 
- 
setSizeChecksum32Create checksums for older types: CRC32 and Adler32- Parameters:
- checksum32- checksum handler
- inputStream- stream used for checksum creation
- Throws:
- TException- process exception
 
- 
makeTException
- 
getResult
 
-