|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.util.ChecksumUtility
public class ChecksumUtility
Utility class for computing the Adler32 checksum of a buffer. This
class is NOT thread-safe.
| Field Summary | |
|---|---|
protected Adler32 |
chk
Used to compute the checksums. |
static ThreadLocal<ChecksumUtility> |
threadChk
ThreadLocal ChecksumUtility factory. |
| Constructor Summary | |
|---|---|
ChecksumUtility()
|
|
| Method Summary | |
|---|---|
int |
checksum(byte[] buf)
|
int |
checksum(byte[] buf,
int sze)
|
int |
checksum(byte[] buf,
int off,
int sze)
|
int |
checksum(ByteBuffer buf)
Compute the Adler32 checksum of the buffer. |
int |
checksum(ByteBuffer buf,
int pos,
int limit)
Compute the Adler32 checksum of the buffer. |
int |
checksum(IByteArraySlice slice)
|
protected int |
getChecksum()
Return the Alder checksum, which is a 32bit value. |
static ChecksumUtility |
getCHK()
Deprecated. Use threadChk and ThreadLocal.get(). |
protected void |
reset()
Reset the checksum. |
protected void |
update(ByteBuffer buf)
Updates the Adler32 checksum from the data in the buffer. |
protected void |
update(ByteBuffer buf,
int pos,
int limit)
Core implementation updates the Adler32 checksum from the data in
the buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ThreadLocal<ChecksumUtility> threadChk
ChecksumUtility factory.
protected final Adler32 chk
| Constructor Detail |
|---|
public ChecksumUtility()
| Method Detail |
|---|
public static ChecksumUtility getCHK()
threadChk and ThreadLocal.get().
public int checksum(ByteBuffer buf)
Adler32 checksum of the buffer. The position, mark,
and limit are unchanged by this operation. The operation is optimized
when the buffer is backed by an array.
buf - The buffer.
public int checksum(ByteBuffer buf,
int pos,
int limit)
Adler32 checksum of the buffer. The position,
mark, and limit are unchanged by this operation. The operation is
optimized when the buffer is backed by an array.
buf - The buffer.pos - The starting position.limit - The limit.
protected void reset()
protected int getChecksum()
protected void update(ByteBuffer buf)
Adler32 checksum from the data in the buffer. The
position, mark, and limit are unchanged by this operation. The operation
is optimized when the buffer is backed by an array.
buf -
protected void update(ByteBuffer buf,
int pos,
int limit)
Adler32 checksum from the data in
the buffer. The position, mark, and limit are unchanged by this
operation. The operation is optimized when the buffer is backed by an
array.
buf - pos - limit - public int checksum(IByteArraySlice slice)
public int checksum(byte[] buf)
public int checksum(byte[] buf,
int sze)
public int checksum(byte[] buf,
int off,
int sze)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||