public class PadAndHashBucketSelector extends Object implements BucketSelector
Modifier and Type | Method and Description |
---|---|
static BucketSelector |
newInstance(Digester digester,
int spread)
Builds an instance of this selector.
|
int[] |
selectBuckets(int seed,
byte[] content)
Selects buckets to store items in.
|
public int[] selectBuckets(int seed, byte[] content)
BucketSelector
The output array must contain integers between 0
and Integer.MAX_VALUE
. It is better
if all integers in that range have the same probability of appearance.
The output must be consistent, for any byte arraycontent
, for any positive integer s
,
multiple invocations of selectBuckets(s, content)
must return the same array.
Different seed values should lead to different resulting arrays.
The number of returned buckets may vary for different contents and the returned array may contain duplicates.
selectBuckets
in interface BucketSelector
seed
- a seed preventing items to fall in the same buckets at all compression levels.content
- the content to store.public static BucketSelector newInstance(Digester digester, int spread)
digester
- the digest algorithm to use.spread
- the number of buckets to store each item in, it is recommended using an odd number to prevent items falling an even number of times in the same bucket to become invisible.Copyright © 2014. All rights reserved.