![]() |
filechampion4j 0.9.8.3
File validation library for Java
|
Classes | |
class | ChecksumTask |
Public Member Functions | |
CalculateChecksum (byte[] inputData) throws IllegalArgumentException | |
byte[] | getChecksum (String hashAlgorithm) throws NoSuchAlgorithmException, InterruptedException, ExecutionException, IOException |
Private Member Functions | |
byte[] | calculateSmallChecksum () |
byte[] | calculateChecksum () throws InterruptedException, ExecutionException, IOException |
Private Attributes | |
MessageDigest | md |
final byte[] | inputData |
int | byteSize |
Static Private Attributes | |
static final int | MIN_CHUNK_SIZE = 1024 * 1024 |
static final int | MAX_CHUNK_SIZE = 3 * 1024 * 1024 |
This class is used to calculate the checksums of a file. It is optimized for large files and uses multiple threads to calculate the checksum in parallel.
Definition at line 20 of file CalculateChecksum.java.
dev.filechampion.filechampion4j.CalculateChecksum.CalculateChecksum | ( | byte[] | inputData | ) | throws IllegalArgumentException |
Creates a new instance of the this class.
inputData | (bytep[]) The input data to calculate the checksum for. |
IllegalArgumentException | Thrown if the input data is null or empty. |
Definition at line 32 of file CalculateChecksum.java.
References dev.filechampion.filechampion4j.CalculateChecksum.inputData.
|
private |
Calculates the checksum for large input data.
InterruptedException | Thrown if the thread is interrupted. |
ExecutionException | Thrown if the execution fails. |
IOException | Thrown if an I/O error occurs. |
Definition at line 72 of file CalculateChecksum.java.
References dev.filechampion.filechampion4j.CalculateChecksum.inputData, dev.filechampion.filechampion4j.CalculateChecksum.MAX_CHUNK_SIZE, dev.filechampion.filechampion4j.CalculateChecksum.md, and dev.filechampion.filechampion4j.CalculateChecksum.MIN_CHUNK_SIZE.
Referenced by dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().
|
private |
Calculates the checksum for small input data.
Definition at line 61 of file CalculateChecksum.java.
References dev.filechampion.filechampion4j.CalculateChecksum.inputData, and dev.filechampion.filechampion4j.CalculateChecksum.md.
Referenced by dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().
byte[] dev.filechampion.filechampion4j.CalculateChecksum.getChecksum | ( | String | hashAlgorithm | ) | throws NoSuchAlgorithmException, InterruptedException, ExecutionException, IOException |
Calculates the checksum for the input data.
hashAlgorithm | (String) The hash algorithm to use. Must be one of: MD5, SHA-1, SHA-256, SHA-512. |
NoSuchAlgorithmException | Thrown if the algorithm is not available. |
InterruptedException | Thrown if the thread is interrupted. |
ExecutionException | Thrown if the execution fails. |
IOException | Thrown if an I/O error occurs. |
Definition at line 49 of file CalculateChecksum.java.
References dev.filechampion.filechampion4j.CalculateChecksum.byteSize, dev.filechampion.filechampion4j.CalculateChecksum.calculateChecksum(), dev.filechampion.filechampion4j.CalculateChecksum.calculateSmallChecksum(), dev.filechampion.filechampion4j.CalculateChecksum.md, and dev.filechampion.filechampion4j.CalculateChecksum.MIN_CHUNK_SIZE.
Referenced by dev.filechampion.filechampion4j.FileValidator.calculateChecksum(), and dev.filechampion.filechampion4j.CliPluginHelper.calculateChecksum().
|
private |
Definition at line 25 of file CalculateChecksum.java.
Referenced by dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().
|
private |
|
staticprivate |
Definition at line 22 of file CalculateChecksum.java.
Referenced by dev.filechampion.filechampion4j.CalculateChecksum.calculateChecksum().
|
private |
|
staticprivate |
Definition at line 21 of file CalculateChecksum.java.
Referenced by dev.filechampion.filechampion4j.CalculateChecksum.calculateChecksum(), and dev.filechampion.filechampion4j.CalculateChecksum.getChecksum().