Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.storemate.shared.hash;
Base class for hashers that can work in incremental fashion, that is, where content is sent via one or more calls to update(int), before final hash value is calculated.

Note: implementations are required to retain state so that it is possible to calculate "partial" hash values throughout content, and call calculateHash() multiple times, at different points. This is different from many other hash calculation abstractions.

NOTE: since 0.9.21, this implements, for interoperability

public abstract class IncrementalHasher32
    implements Checksum
    protected byte[] _singleByteArray;
Method for checking number of bytes that have been sent to update(int) since creation or last call to reset()
    public abstract long getLength();

Method for completing calculation of the hash value for the full byte sequence fed with update(int). This will NOT reset state, so it is completely legal to feed more content with update(int), and calculate further hash codes with same instance.

NOTE: since no state is reset with a call, calling this method typically results in calculation to finalize state. So if you need to access same hash value multiple times, call this method once and retain hash value.

    public abstract int calculateHash();
    public abstract void reset();
    public abstract void update(byte[] dataint offsetint len);
    public long getValue() {
        return calculateHash();
    public void update(int b) {
        if ( == null) {
             = new byte[1];
        [0] = (byteb;
        update(, 0, 1);
New to GrepCode? Check out our FAQ X