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 String
format entry for logstatic MessageDigestType
getAlgorithm
(String algorithmS) Convert a string form of checksum type to an enum form lowercase and strip punctuationreturn constructed hex checksumreturn constructed Bit 64 checksumstatic String
getChecksumBit64
(String checksumHex) return constructed Bit 64 checksumstatic String
getCheckSumBit64
(byte[] bytes) static String
getChecksumHex
(String checksumBit64) return hex checksum from Bit 64 checksumreturn constructed checksum typelong
return match file sizeprotected TException
makeTException
(String header, Exception ex) protected void
setSizeChecksum
(InputStream inputStream, String checksumType) Get size and checksum for newer checksum typesprotected void
setSizeChecksum32
(Checksum checksum32, InputStream inputStream) Create checksums for older types: CRC32 and Adler32static byte[]
static String
toHexString
(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 creationchecksumType
-inLogger
-- 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
-