|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.metastatic.rsync.Checksum32
A simple 32-bit "rolling" checksum. This checksum algorithm is based upon the algorithm outlined in the paper "The rsync algorithm" by Andrew Tridgell and Paul Mackerras. The algorithm works in such a way that if one knows the sum of a block Xk...Xl, then it is a simple matter to compute the sum for Xk+1...Xl+1.
| Field Summary | |
|---|---|
protected int |
a
The first half of the checksum. |
protected int |
b
The second half of the checksum. |
protected byte[] |
block
The block from which the checksum is computed. |
protected int |
char_offset
|
protected int |
k
The place from whence the current checksum has been computed. |
protected int |
l
The place to where the current checksum has been computed. |
protected byte[] |
new_block
The block that is recieving new input. |
protected int |
new_index
The index in new_block where the newest byte has
been stored. |
| Constructor Summary | |
|---|---|
Checksum32()
|
|
Checksum32(int char_offset)
Creates a new rolling checksum. |
|
| Method Summary | |
|---|---|
void |
check(byte[] buf,
int off,
int len)
Update the checksum with an entirely different block, and potentially a different block length. |
Object |
clone()
Copies this checksum instance into a new instance. |
boolean |
equals(Object o)
Tests if a particular checksum is equal to this checksum. |
int |
getValue()
Return the value of the currently computed checksum. |
void |
reset()
Reset the checksum. |
void |
roll(byte bt)
"Roll" the checksum. |
void |
trim()
Update the checksum by trimming off a byte only, not adding anything. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final int char_offset
protected int a
protected int b
protected int k
protected int l
protected byte[] block
protected int new_index
new_block where the newest byte has
been stored.
protected byte[] new_block
| Constructor Detail |
public Checksum32(int char_offset)
public Checksum32()
| Method Detail |
public int getValue()
getValue in interface RollingChecksumpublic void reset()
reset in interface RollingChecksumpublic void roll(byte bt)
roll in interface RollingChecksumbt - The next byte.public void trim()
trim in interface RollingChecksum
public void check(byte[] buf,
int off,
int len)
check in interface RollingChecksumbuf - The byte array that holds the new block.off - From whence to begin reading.len - The length of the block to read.public Object clone()
RollingChecksumCloneable interface.
clone in interface RollingChecksumclone in class Objectpublic boolean equals(Object o)
RollingChecksum
equals in interface RollingChecksumequals in class Objecto - The object to test.
true if this checksum equals the other
checksum.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||