jonelo.jacksum

Class JacksumAPI


public class JacksumAPI
extends java.lang.Object

This is the Jacksum Application Program Interface (API). Use this API to get an instance of an algorithm and to determine both the available algorithms and available encodings for the checksum.

Field Summary

static String
NAME
static String
VERSION

Method Summary

static Map
getAvailableAlgorithms()
Gets all available algorithms.
static Map
getAvailableEncodings()
Gets all available encodings of a checksum.
static AbstractChecksum
getChecksumInstance(String algorithm)
Gets an object of a checksum algorithm.
static AbstractChecksum
getChecksumInstance(String algorithm, boolean alternate)
Gets an object of a checksum algorithm.
static String
getName()
determines the Name of this API.
static Version
getVersion()
Determines the Version of this API.
static String
getVersionString()
determines the Version of this API.
static void
runCLI(String[] args)
runs the CLI

Field Details

NAME

public static final String NAME

VERSION

public static final String VERSION

Method Details

getAvailableAlgorithms

public static Map getAvailableAlgorithms()
Gets all available algorithms.
Returns:
a Map with key and value pairs, both are Strings (the key can be used to feed the method getChecksumInstance(), the value of the pair is the name of the algorithm which can be used in a GUI for example)

getAvailableEncodings

public static Map getAvailableEncodings()
Gets all available encodings of a checksum.
Returns:
a Map with key and value pairs, both are Strings (the key can be used to feed the method setEncoding(), the value of the pair is a description of the encoding)

getChecksumInstance

public static AbstractChecksum getChecksumInstance(String algorithm)
            throws NoSuchAlgorithmException
Gets an object of a checksum algorithm. It always tries to use implementations from the Java API
Parameters:
algorithm - code for the checksum algorithm
Returns:
a checksum algorithm object

getChecksumInstance

public static AbstractChecksum getChecksumInstance(String algorithm,
                                                   boolean alternate)
            throws NoSuchAlgorithmException
Gets an object of a checksum algorithm.
Parameters:
algorithm - code for the checksum algorithm
alternate - a pure Java implementation is preferred
Returns:
a checksum algorithm object

getName

public static final String getName()
determines the Name of this API.
Returns:
a String representing the Name of this API

getVersion

public static final Version getVersion()
Determines the Version of this API.
Returns:
a Version object representing the version of this API

getVersionString

public static final String getVersionString()
determines the Version of this API.
Returns:
a String representing the Version of this API

runCLI

public static void runCLI(String[] args)
runs the CLI