Package com.scurrilous.circe.impl
Class AbstractIncrementalIntHash
- java.lang.Object
 - 
- com.scurrilous.circe.impl.AbstractIncrementalIntHash
 
 
- 
- All Implemented Interfaces:
 Hash,IncrementalIntHash,StatelessHash,StatelessIntHash
- Direct Known Subclasses:
 AbstractIntCrc,Sse42Crc32C
public abstract class AbstractIncrementalIntHash extends java.lang.Object implements IncrementalIntHash
Base implementation for incremental stateless integer hash functions. 
- 
- 
Constructor Summary
Constructors Constructor Description AbstractIncrementalIntHash() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcalculate(byte[] input)Evaluates this hash function for the entire given input array.intcalculate(byte[] input, int index, int length)Evaluates this hash function for the given range of the given input array.intcalculate(long address, long length)Evaluates this hash function for the memory with the given address and length.intcalculate(java.nio.ByteBuffer input)Evaluates this hash function with the remaining contents of the given input buffer.StatefulIntHashcreateStateful()Returns a new instance of stateful version of this hash function.protected abstract intinitial()The initial state of the hash function, which is the same as the output value for an empty input sequence.intresume(int current, byte[] input)Evaluates this hash function as if the entire given input array were appended to the previously hashed input.intresume(int current, byte[] input, int index, int length)Evaluates this hash function as if the given range of the given input array were appended to the previously hashed input.intresume(int current, long address, long length)Evaluates this hash function as if the memory with the given address and length were appended to the previously hashed input.intresume(int current, java.nio.ByteBuffer input)Evaluates this hash function as if the remaining contents of the given input buffer were appended to the previously hashed input.protected abstract intresumeUnchecked(int current, byte[] input, int index, int length)Evaluates this hash function as if the given range of the given input array were appended to the previously hashed input.booleansupportsUnsafe()Returns whether this hash function supports unsafe access to arbitrary memory addresses using methods such asStatefulHash.update(long, long),StatelessIntHash.calculate(long, long), orIncrementalIntHash.resume(int, long, long). 
 - 
 
- 
- 
Method Detail
- 
supportsUnsafe
public boolean supportsUnsafe()
Description copied from interface:HashReturns whether this hash function supports unsafe access to arbitrary memory addresses using methods such asStatefulHash.update(long, long),StatelessIntHash.calculate(long, long), orIncrementalIntHash.resume(int, long, long). Such functions are generally implemented in native code.- Specified by:
 supportsUnsafein interfaceHash- Returns:
 - true if unsafe access is supported, false if not
 
 
- 
createStateful
public StatefulIntHash createStateful()
Description copied from interface:StatelessIntHashReturns a new instance of stateful version of this hash function.- Specified by:
 createStatefulin interfaceStatelessHash- Specified by:
 createStatefulin interfaceStatelessIntHash- Returns:
 - the stateful version of this hash function
 
 
- 
calculate
public int calculate(byte[] input)
Description copied from interface:StatelessIntHashEvaluates this hash function for the entire given input array.- Specified by:
 calculatein interfaceStatelessIntHash- Parameters:
 input- the input array- Returns:
 - the output of the hash function
 
 
- 
calculate
public int calculate(byte[] input, int index, int length)Description copied from interface:StatelessIntHashEvaluates this hash function for the given range of the given input array.- Specified by:
 calculatein interfaceStatelessIntHash- Parameters:
 input- the input arrayindex- the starting index of the first input bytelength- the length of the input range- Returns:
 - the output of the hash function
 
 
- 
calculate
public int calculate(java.nio.ByteBuffer input)
Description copied from interface:StatelessIntHashEvaluates this hash function with the remaining contents of the given input buffer. This method leaves the buffer position at the limit.- Specified by:
 calculatein interfaceStatelessIntHash- Parameters:
 input- the input buffer- Returns:
 - the output of the hash function
 
 
- 
calculate
public int calculate(long address, long length)Description copied from interface:StatelessIntHashEvaluates this hash function for the memory with the given address and length. The arguments are generally not checked in any way and will likely lead to a VM crash or undefined results if invalid.- Specified by:
 calculatein interfaceStatelessIntHash- Parameters:
 address- the base address of the inputlength- the length of the input- Returns:
 - the output of the hash function
 - See Also:
 Hash.supportsUnsafe()
 
- 
resume
public int resume(int current, byte[] input)Description copied from interface:IncrementalIntHashEvaluates this hash function as if the entire given input array were appended to the previously hashed input.- Specified by:
 resumein interfaceIncrementalIntHash- Parameters:
 current- the hash output for input hashed so farinput- the input array- Returns:
 - the output of the hash function for the concatenated input
 
 
- 
resume
public int resume(int current, byte[] input, int index, int length)Description copied from interface:IncrementalIntHashEvaluates this hash function as if the given range of the given input array were appended to the previously hashed input.- Specified by:
 resumein interfaceIncrementalIntHash- Parameters:
 current- the hash output for input hashed so farinput- the input arrayindex- the starting index of the first input bytelength- the length of the input range- Returns:
 - the output of the hash function for the concatenated input
 
 
- 
resume
public int resume(int current, java.nio.ByteBuffer input)Description copied from interface:IncrementalIntHashEvaluates this hash function as if the remaining contents of the given input buffer were appended to the previously hashed input. This method leaves the buffer position at the limit.- Specified by:
 resumein interfaceIncrementalIntHash- Parameters:
 current- the hash output for input hashed so farinput- the input buffer- Returns:
 - the output of the hash function for the concatenated input
 
 
- 
resume
public int resume(int current, long address, long length)Description copied from interface:IncrementalIntHashEvaluates this hash function as if the memory with the given address and length were appended to the previously hashed input. The arguments are generally not checked in any way and will likely lead to a VM crash or undefined results if invalid.- Specified by:
 resumein interfaceIncrementalIntHash- Parameters:
 current- the hash output for input hashed so faraddress- the base address of the inputlength- the length of the input- Returns:
 - the output of the hash function for the concatenated input
 - See Also:
 Hash.supportsUnsafe()
 
- 
initial
protected abstract int initial()
The initial state of the hash function, which is the same as the output value for an empty input sequence.- Returns:
 - the initial hash state/output
 
 
- 
resumeUnchecked
protected abstract int resumeUnchecked(int current, byte[] input, int index, int length)Evaluates this hash function as if the given range of the given input array were appended to the previously hashed input. The index and length parameters have already been validated.- Parameters:
 current- the hash output for input hashed so farinput- the input arrayindex- the starting index of the first input bytelength- the length of the input range- Returns:
 - the output of the hash function for the concatenated input
 
 
 - 
 
 -