java.lang.Object
org.seppiko.commons.utils.crypto.crc.CRC16MAXIM
- All Implemented Interfaces:
Checksum
A class that can be used to compute the CRC16 of a data stream with MAXIM.
- Author:
- Leonard Woo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonggetValue()Returns the current checksum value.voidreset()Resets the checksum to its initial value.voidupdate(byte[] b, int off, int len) Updates the CRC-16 checksum with the specified array of bytes.voidupdate(int b) Updates the CRC-16 checksum with the specified byte.
-
Constructor Details
-
CRC16MAXIM
public CRC16MAXIM()Create CRC-16 instance.
-
-
Method Details
-
update
public void update(int b) Updates the CRC-16 checksum with the specified byte. -
update
public void update(byte[] b, int off, int len) throws NullPointerException, ArrayIndexOutOfBoundsException Updates the CRC-16 checksum with the specified array of bytes.- Specified by:
updatein interfaceChecksum- Parameters:
b- data byte array.off- data init offset.len- data length.- Throws:
NullPointerException- data isnull.ArrayIndexOutOfBoundsException- if off is negative, or len is negative, or off+len is negative or greater than the length of the array b.
-
getValue
public long getValue()Returns the current checksum value. -
reset
public void reset()Resets the checksum to its initial value.
-