public final class ChecksumUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
calc(byte[] dataBytes,
Collection<String> algos) |
static Map<String,Object> |
calc(File dataFile,
Collection<String> algos)
Calculates checksums for the specified file.
|
static String |
read(File checksumFile)
Extracts the checksum from the specified file.
|
static String |
toHexString(byte[] bytes)
Creates a hexadecimal representation of the specified bytes.
|
public static String read(File checksumFile) throws IOException
checksumFile
- The path to the checksum file, must not be null
.null
.IOException
- If the checksum does not exist or could not be read for other reasons.public static Map<String,Object> calc(File dataFile, Collection<String> algos) throws IOException
dataFile
- The file for which to calculate checksums, must not be null
.algos
- The names of checksum algorithms (cf. MessageDigest.getInstance(String)
to use, must not be
null
.null
.IOException
- If the data file could not be read.public static Map<String,Object> calc(byte[] dataBytes, Collection<String> algos) throws IOException
IOException
public static String toHexString(byte[] bytes)
bytes
- The bytes to represent in hex notation, may be be null
.null
if the input was null
.Copyright © 2010–2021 The Apache Software Foundation. All rights reserved.