voldemort.store.readonly.checksum
Class CheckSum

java.lang.Object
  extended by voldemort.store.readonly.checksum.CheckSum
Direct Known Subclasses:
Adler32CheckSum, CRC32CheckSum, MD5CheckSum

public abstract class CheckSum
extends java.lang.Object


Nested Class Summary
static class CheckSum.CheckSumType
           
 
Constructor Summary
CheckSum()
           
 
Method Summary
static int checkSumLength(CheckSum.CheckSumType type)
           
static CheckSum.CheckSumType fromString(java.lang.String input)
           
abstract  byte[] getCheckSum()
          Get the checkSum of the buffer till now, after which buffer is reset
static CheckSum getInstance(CheckSum.CheckSumType type)
           
static CheckSum getInstance(java.lang.String algorithm)
           
abstract  void reset()
          Reset the checksum generator
static java.lang.String toString(CheckSum.CheckSumType type)
           
 void update(byte[] input)
          Update the checksum buffer to include input
abstract  void update(byte[] input, int startIndex, int length)
          Update the checksum buffer to include input with startIndex and length.
 void update(int number)
          Update the underlying buffer using the integer
 void update(short number)
          Update the underlying buffer using the short
 byte[] updateAndGetCheckSum(byte[] input, int startIndex, int length)
          Update and get checksum + reset the digest for next use
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckSum

public CheckSum()
Method Detail

update

public abstract void update(byte[] input,
                            int startIndex,
                            int length)
Update the checksum buffer to include input with startIndex and length. Following calls to multiple 'update's you need to call 'getCheckSum' which will reset the buffer as well

Parameters:
input -
startIndex -
length -

getCheckSum

public abstract byte[] getCheckSum()
Get the checkSum of the buffer till now, after which buffer is reset


reset

public abstract void reset()
Reset the checksum generator


updateAndGetCheckSum

public byte[] updateAndGetCheckSum(byte[] input,
                                   int startIndex,
                                   int length)
Update and get checksum + reset the digest for next use

Parameters:
input - The input byte array
startIndex - The index to start reading from
length - The number of bytes to read
Returns:
Returns the checksum byte array

update

public void update(int number)
Update the underlying buffer using the integer

Parameters:
number - number to be stored in checksum buffer

update

public void update(short number)
Update the underlying buffer using the short

Parameters:
number - number to be stored in checksum buffer

update

public void update(byte[] input)
Update the checksum buffer to include input

Parameters:
input - bytes added to the buffer

getInstance

public static CheckSum getInstance(CheckSum.CheckSumType type)

checkSumLength

public static int checkSumLength(CheckSum.CheckSumType type)

toString

public static java.lang.String toString(CheckSum.CheckSumType type)

fromString

public static CheckSum.CheckSumType fromString(java.lang.String input)

getInstance

public static CheckSum getInstance(java.lang.String algorithm)


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu