com.liferay.portal.kernel.io.delta
Class RollingChecksum

java.lang.Object
  extended by com.liferay.portal.kernel.io.delta.RollingChecksum

public class RollingChecksum
extends java.lang.Object

Author:
Connor McKay

Constructor Summary
RollingChecksum(java.nio.channels.ReadableByteChannel readableByteChannel, int blockLength)
           
 
Method Summary
 int currentBlockLength()
           
protected  void generateWeakChecksum()
           
 byte getFirstByte()
          Returns the first byte of data in the current block.
 int getPosition()
          Returns the position of the start of the current block in the file.
 boolean hasNext()
           
 void nextBlock()
           
 void nextByte()
           
 byte[] strongChecksum()
          Returns the strong checksum of the current block.
 int weakChecksum()
          Returns the weak checksum of the current block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RollingChecksum

public RollingChecksum(java.nio.channels.ReadableByteChannel readableByteChannel,
                       int blockLength)
                throws java.io.IOException
Throws:
java.io.IOException
Method Detail

currentBlockLength

public int currentBlockLength()

getFirstByte

public byte getFirstByte()
Returns the first byte of data in the current block.


getPosition

public int getPosition()
Returns the position of the start of the current block in the file.


hasNext

public boolean hasNext()
                throws java.io.IOException
Throws:
java.io.IOException

nextBlock

public void nextBlock()
               throws java.io.IOException
Throws:
java.io.IOException

nextByte

public void nextByte()
              throws java.io.IOException
Throws:
java.io.IOException

strongChecksum

public byte[] strongChecksum()
Returns the strong checksum of the current block.


weakChecksum

public int weakChecksum()
Returns the weak checksum of the current block.


generateWeakChecksum

protected void generateWeakChecksum()
                             throws java.io.IOException
Throws:
java.io.IOException