An abstract class that is actually the parent of all algorithms.
BASE16
public static final String BASE16
BASE32
public static final String BASE32
BASE64
public static final String BASE64
BIN
public static final String BIN
BUBBLEBABBLE
public static final String BUBBLEBABBLE
BUFFERSIZE
public static final int BUFFERSIZE
DEC
public static final String DEC
HEX
public static final String HEX
HEX_UPPERCASE
public static final String HEX_UPPERCASE
OCT
public static final String OCT
encoding
protected String encoding
filename
protected String filename
groupChar
protected char groupChar
length
protected long length
name
protected String name
separator
protected String separator
timestamp
protected long timestamp
timestampFormat
protected String timestampFormat
timestampFormatter
protected Format timestampFormatter
value
protected long value
equals
public boolean equals(Object anObject)
Returns true only if the specified checksum is equal to this object.
firstFormat
public void firstFormat(StringBuffer format)
format
public String format(String format)
getByteArray
public byte[] getByteArray()
Returns the result of the computation as byte array.
getEncoding
public String getEncoding()
Gets the encoding of the checksum.
getFilename
public String getFilename()
Gets the filename.
getFormattedValue
public String getFormattedValue()
Returns the checksum formatted.
getGroup
public int getGroup()
Gets the number of groups (make sense only if encoding is HEX or HEXUP).
getGroupChar
public char getGroupChar()
Gets the group char (works only if encoding is HEX or HEXUP).
getHexValue
public String getHexValue()
As of Jacksum version 1.6
replaced by getByteArray()
.
Gets the format of the checksum as hex.
getLength
public long getLength()
Returns the length of the processed bytes.
getName
public String getName()
getSeparator
public String getSeparator()
Gets the separator.
getTimestamp
public long getTimestamp()
getTimestampFormat
public String getTimestampFormat()
Gets the format of the timestamp.
getTimestampFormatted
public String getTimestampFormatted()
Gets the timestamp, formatted.
getValue
public long getValue()
Returns the value of the checksum.
hashCode
public int hashCode()
isGroupWanted
public boolean isGroupWanted()
Returns true if groups are wanted (make sense only if encoding is HEX or HEXUP).
isTimestampWanted
public boolean isTimestampWanted()
Determines if a timestamp is wanted.
readFile
public long readFile(String filename)
throws IOException
Reads a file and calculates the checksum from it.
filename
- - the file which should be read
readFile
public long readFile(String filename,
boolean reset)
throws IOException
Reads a file and calculates the checksum from it.
filename
- the filename which should be readreset
- if reset is true, reset() will be launched before the checksum gets updated
reset
public void reset()
Resets the checksum to its initial value for further use.
setEncoding
public void setEncoding(String encoding)
throws EncodingException
Sets the encoding of the checksum.
encoding
- the encoding of the checksum.
setFilename
public void setFilename(String filename)
Sets the filename.
setGroup
public void setGroup(int group)
Sets the number of groups (make sense only if encoding is HEX or HEXUP).
setGroupChar
public void setGroupChar(char groupChar)
Sets the group char (make sense only if encoding is HEX or HEXUP).
setGrouping
public void setGrouping(int group,
char groupChar)
Sets the number of groups and the group char.
(make sense only if encoding is HEX or HEXUP).
setHex
public void setHex(boolean hex)
As of Jacksum version 1.6
replaced by setEncoding()
.
Sets the format of the checksum as hex or default.
setName
public void setName(String name)
Set the name of the algorithm
name
- the name of the algorithm
setSeparator
public void setSeparator(String separator)
Sets the separator for the tokens.
setTimestamp
public void setTimestamp(String filename)
Sets the timestamp.
filename
- the file from which the timestamp should be gathered.
setTimestampFormat
public void setTimestampFormat(String timestampFormat)
Sets the timestampFormat to force a timestamp output
timestampFormat
- the format of the timestamp.
setUpperCase
public void setUpperCase(boolean uppercase)
As of Jacksum version 1.6
replaced by setEncoding()
.
Sets the format of the checksum as uppercase hex or lowercase hex.
toString
public String toString()
The toString() method.
update
public void update(byte b)
Updates the checksum with the specified byte.
update
public void update(byte[] bytes)
Updates the current checksum with the specified array of bytes.
update
public void update(byte[] bytes,
int offset,
int length)
Updates the current checksum with the specified array of bytes.
bytes
- the byte array to update the checksum withoffset
- the start offset of the datalength
- the number of bytes to use for the update
update
public void update(int b)
Updates the checksum with the specified byte.