com.nothome.delta
Class Checksum

java.lang.Object
  extended by com.nothome.delta.Checksum

public class Checksum
extends Object

Checksum computation class.


Constructor Summary
Checksum(SeekableSource source, int chunkSize)
          Initialize checksums for source.
 
Method Summary
 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(ByteBuffer bb, int len)
          Finds the checksum computed from the buffer.
 String toString()
          Returns a debug String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Checksum

public Checksum(SeekableSource source,
                int chunkSize)
         throws IOException
Initialize checksums for source. The checksum for the chunkSize bytes at offset chunkSize * i is inserted into a hash map.

Throws:
IOException
Method Detail

queryChecksum

public static long queryChecksum(ByteBuffer bb,
                                 int len)
Finds the checksum computed from the buffer. Marks, gets, then resets the buffer.


incrementChecksum

public static long incrementChecksum(long checksum,
                                     byte out,
                                     byte in,
                                     int chunkSize)
Increments a checksum.

Parameters:
checksum - initial checksum
out - byte leaving view
in - byte entering view
chunkSize - size of chunks
Returns:
new checksum

getSingleHash

public static char[] getSingleHash()
256 random hash values.


findChecksumIndex

public int findChecksumIndex(long hashf)
Finds the index of a checksum.


toString

public String toString()
Returns a debug String.

Overrides:
toString in class Object


Copyright © 2003-2008. All Rights Reserved.