public class Adler32WithInPlaceUpdate extends Object implements ChecksumWithInPlaceUpdate
Constructor and Description |
---|
Adler32WithInPlaceUpdate()
Creates a new Adler32WithInPlaceUpdate object
|
Modifier and Type | Method and Description |
---|---|
void |
append(ByteBuffer buffer)
Append a buffer at the end and updates the checksum value
|
long |
getValue()
Returns the Adler32 checksum value
|
long |
length()
length returns the length till which checksum has been calculated.
|
void |
reset()
Resets the Adler32 checksum to initial value of 1 and the length to 0
|
void |
restore(long checksum,
long length)
Restores the state to a previously calculated checksum value and length for a given file.
|
String |
toString() |
void |
update(byte[] b,
int off,
int len)
Update a byte array of length len from position off and update the checksum
NOTE: This operation is not supported as in many cases it helps not reading the existing bytes as the
application can provide from its cache.
|
void |
update(ByteBuffer updated,
ByteBuffer previous,
long position)
This method performs in place update operation, by replacing previous bytes at offset 'position' with 'updated'
bytes and updates the checksum value.
|
void |
update(int b)
Append a byte at the end and update the checksum
NOTE: This operation is not supported and append(ByteBuffer) should be used instead
|
public Adler32WithInPlaceUpdate()
public void update(int b)
public void update(byte[] b, int off, int len)
public long getValue()
public void reset()
public void restore(long checksum, long length)
restore
in interface ChecksumWithInPlaceUpdate
checksum
- the Adler32 checksum value to be restoredlength
- the total length of the file till which checksum was calculated to be restoredpublic long length()
length
in interface ChecksumWithInPlaceUpdate
public void append(ByteBuffer buffer)
append
in interface ChecksumWithInPlaceUpdate
buffer
- the input buffer, which needs to be added at the end of given filepublic void update(ByteBuffer updated, ByteBuffer previous, long position)
update
in interface ChecksumWithInPlaceUpdate
updated
- the buffer containing the updated data, from position posprevious
- the buffer containing the previous data, from position posposition
- the position from which the data is to be updated