Package org.biojava.nbio.core.util
Class CRC64Checksum
java.lang.Object
org.biojava.nbio.core.util.CRC64Checksum
- All Implemented Interfaces:
Checksum
Utility class that calculates a CRC64 checksum on a stream of bytes. Code was
based on some from BioPerl. Note that we use longs then cast them to avoid
the lack of an unsigned int in Java. Longs are 64-bit but we are only using
the bottom 32 bits. An int is 32-bit but encodes sign so we can get amusing
results if we don't allow for this.
- Author:
- Unknown. Copied from Expasy4J for convenience. See http://dev.isb-sib.ch/projects/expasy4j/
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getValue()
void
reset()
toString()
Returns a zero-padded 16 character wide string containing the current value of this checksum in uppercase hexadecimal format.void
update
(byte[] b, int offset, int length) Updates the CRC-64 checksum with the specified array of bytes.void
update
(int b) void
-
Constructor Details
-
CRC64Checksum
public CRC64Checksum()
-
-
Method Details
-
update
-
update
Updates the CRC-64 checksum with the specified array of bytes.
Note that BioJava before version 6.0 implemented this method incorrectly, usinglength
as an index.- Specified by:
update
in interfaceChecksum
- Throws:
IllegalArgumentException
- ifoffset
is negative, orlength
is negative, oroffset+length
is negative or greater than the length of the arrayb
.
-
update
-
getValue
-
toString
Returns a zero-padded 16 character wide string containing the current value of this checksum in uppercase hexadecimal format. -
reset
-