public abstract class Hash extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
INVALID_HASH
Constant to denote invalid hash type.
|
static int |
JENKINS_HASH
Constant to denote
JenkinsHash. |
static int |
MURMUR_HASH
Constant to denote
MurmurHash. |
| 构造器和说明 |
|---|
Hash() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
getHashType(Configuration conf)
This utility method converts the name of the configured
hash type to a symbolic constant.
|
static Hash |
getInstance(Configuration conf)
Get a singleton instance of hash function of a type
defined in the configuration.
|
static Hash |
getInstance(int type)
Get a singleton instance of hash function of a given type.
|
int |
hash(byte[] bytes)
Calculate a hash using all bytes from the input argument, and
a seed of -1.
|
int |
hash(byte[] bytes,
int initval)
Calculate a hash using all bytes from the input argument,
and a provided seed value.
|
abstract int |
hash(byte[] bytes,
int length,
int initval)
Calculate a hash using bytes from 0 to
length, and
the provided seed value |
static int |
parseHashType(String name)
This utility method converts String representation of hash function name
to a symbolic constant.
|
public static final int INVALID_HASH
public static final int JENKINS_HASH
JenkinsHash.public static final int MURMUR_HASH
MurmurHash.public static int parseHashType(String name)
name - hash function namepublic static int getHashType(Configuration conf)
conf - configurationpublic static Hash getInstance(int type)
type - predefined hash typepublic static Hash getInstance(Configuration conf)
conf - current configurationpublic int hash(byte[] bytes)
bytes - input bytespublic int hash(byte[] bytes,
int initval)
bytes - input bytesinitval - seed valuepublic abstract int hash(byte[] bytes,
int length,
int initval)
length, and
the provided seed valuebytes - input byteslength - length of the valid bytes to considerinitval - seed valueCopyright © 2009 The Apache Software Foundation