public class Checksum
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Long,java.lang.Integer> |
checksums |
(package private) static boolean |
debug |
private static char[] |
single_hash |
Constructor and Description |
---|
Checksum(SeekableSource source,
int chunkSize)
Initialize checksums for source.
|
Modifier and Type | Method and Description |
---|---|
int |
findChecksumIndex(long hashf)
Finds the index of a checksum.
|
static char[] |
getSingleHash()
256 random hash values.
|
static long |
incrementChecksum(long checksum,
byte out,
byte in,
int chunkSize)
Increments a checksum.
|
static long |
queryChecksum(java.nio.ByteBuffer bb,
int len)
Finds the checksum computed from the buffer.
|
private static long |
queryChecksum0(java.nio.ByteBuffer bb,
int len) |
java.lang.String |
toString()
Returns a debug
String . |
static final boolean debug
private java.util.Map<java.lang.Long,java.lang.Integer> checksums
private static final char[] single_hash
public Checksum(SeekableSource source, int chunkSize) throws java.io.IOException
chunkSize
bytes at offset
chunkSize
* i is inserted into a hash map.java.io.IOException
public static long queryChecksum(java.nio.ByteBuffer bb, int len)
private static long queryChecksum0(java.nio.ByteBuffer bb, int len)
public static long incrementChecksum(long checksum, byte out, byte in, int chunkSize)
checksum
- initial checksumout
- byte leaving viewin
- byte entering viewchunkSize
- size of chunkspublic static char[] getSingleHash()
public int findChecksumIndex(long hashf)
public java.lang.String toString()
String
.toString
in class java.lang.Object