public final class ChecksumUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.log4j.Logger |
LOGGER
The LOGGER.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
getChecksum(byte[] bytes,
de.alpharogroup.file.checksum.Algorithm algorithm)
Gets the checksum from the given byte array with an instance of.
|
static String |
getChecksum(Byte[] bytes,
de.alpharogroup.file.checksum.Algorithm algorithm)
Gets the checksum from the given byte array with an instance of.
|
static String |
getChecksum(byte[] bytes,
String algorithm)
Gets the checksum from the given byte array with an instance of.
|
static String |
getChecksum(Byte[] bytes,
String algorithm)
Gets the checksum from the given byte array with an instance of.
|
static String |
getChecksum(File file,
de.alpharogroup.file.checksum.Algorithm algorithm)
Gets the checksum from the given file with an instance of the given algorithm.
|
static long |
getChecksum(File file,
boolean crc)
Gets the checksum from the given file.
|
static String |
getChecksum(File file,
String algorithm)
Gets the checksum from the given file with an instance of the given algorithm.
|
static long |
getCheckSumAdler32(byte[] bytes)
Gets the checksum from the given byte array with an instance of.
|
static long |
getCheckSumAdler32(File file)
Gets the checksum from the given file with an instance of.
|
static long |
getCheckSumCRC32(byte[] bytes)
Gets the checksum from the given byte array with an instance of.
|
static long |
getCheckSumCRC32(File file)
Gets the checksum from the given file with an instance of.
|
static String |
getChecksumQuietly(byte[] bytes,
de.alpharogroup.file.checksum.Algorithm algorithm)
Gets the checksum quietly from the given byte array with an instance of.
|
static String |
getChecksumQuietly(byte[] bytes,
String algorithm)
Gets the checksum quietly from the given byte array with an instance of.
|
static String |
getChecksumQuietly(Byte[] bytes,
String algorithm)
Gets the checksum quietly from the given byte array with an instance of.
|
static String |
getChecksumQuietly(File file,
de.alpharogroup.file.checksum.Algorithm algorithm)
Gets the checksum quietly from the given file with an instance of the given algorithm.
|
static void |
main(String[] args)
The main method.
|
public static String getChecksum(byte[] bytes, de.alpharogroup.file.checksum.Algorithm algorithm) throws NoSuchAlgorithmException
bytes - the byte array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static String getChecksum(byte[] bytes, String algorithm) throws NoSuchAlgorithmException
bytes - the byte array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static String getChecksum(Byte[] bytes, de.alpharogroup.file.checksum.Algorithm algorithm) throws NoSuchAlgorithmException
bytes - the Byte object array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static String getChecksum(Byte[] bytes, String algorithm) throws NoSuchAlgorithmException
bytes - the Byte object array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static String getChecksum(File file, de.alpharogroup.file.checksum.Algorithm algorithm) throws NoSuchAlgorithmException
file - the file.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static long getChecksum(File file, boolean crc) throws FileNotFoundException, IOException
java.util.zip.CRC32 otherwise with an instance
of java.util.zip.Adler32.file - The file The file from what to get the checksum.crc - The crc If the flag crc is true than the CheckedInputStream is constructed with an
instance of CRC32 object otherwise it is constructed with an
instance ofFileNotFoundException - Is thrown if the file is not found.IOException - Signals that an I/O exception has occurred. CRC32 object
otherwise it is constructed with an instance of Adler32
object. Adler32 object.public static String getChecksum(File file, String algorithm) throws NoSuchAlgorithmException
file - the file.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.
MessageDigest object.public static long getCheckSumAdler32(byte[] bytes)
bytes - The byte array.Adler32 object.public static long getCheckSumAdler32(File file)
file - The file.Adler32 object.public static long getCheckSumCRC32(byte[] bytes)
bytes - The byte array.CRC32 object.public static long getCheckSumCRC32(File file)
file - The file.CRC32 object.public static String getChecksumQuietly(byte[] bytes, de.alpharogroup.file.checksum.Algorithm algorithm)
bytes - the byte array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".public static String getChecksumQuietly(byte[] bytes, String algorithm)
bytes - the byte array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".public static String getChecksumQuietly(Byte[] bytes, String algorithm)
bytes - the Byte object array.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".public static String getChecksumQuietly(File file, de.alpharogroup.file.checksum.Algorithm algorithm)
file - the file.algorithm - the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".MessageDigest object.public static void main(String[] args) throws FileNotFoundException, IOException, NoSuchAlgorithmException
args - The argsFileNotFoundException - Is thrown if the file is not found.IOException - Signals that an I/O exception has occurred.NoSuchAlgorithmException - Is thrown if the algorithm is not supported or does not exists.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.