public class SimpleBloomFilter extends Object implements BloomFilter
InternalBloomFilter.| Constructor and Description |
|---|
SimpleBloomFilter(ByteBuffer byteBuffer)
Creates
SimpleBloomFilter from the given ByteBuffer. |
SimpleBloomFilter(int numEntries,
double errorRate,
int hashType)
Create a new Bloom filter with the given configurations.
|
SimpleBloomFilter(String serString)
Create the bloom filter from serialized string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(byte[] keyBytes)
Add a key's bytes, representing UTF8-encoded string, to the
BloomFilter. |
void |
add(String key)
Add a key represented by a
String to the BloomFilter. |
BloomFilterTypeCode |
getBloomFilterTypeCode() |
boolean |
mightContain(String key)
Tests for key membership.
|
void |
readFields(DataInput in) |
String |
serializeToString()
Serialize the bloom filter as a string.
|
void |
write(DataOutput out) |
public SimpleBloomFilter(int numEntries,
double errorRate,
int hashType)
numEntries - The total number of entries.errorRate - maximum allowable error rate.hashType - type of the hashing function (see Hash).public SimpleBloomFilter(String serString)
serString - serialized string which represents the SimpleBloomFilterpublic SimpleBloomFilter(ByteBuffer byteBuffer)
SimpleBloomFilter from the given ByteBuffer.byteBuffer - ByteBuffer containing the serialized bloom filter.public void add(String key)
BloomFilterString to the BloomFilter.add in interface BloomFilterkey - the key to the added to the BloomFilterpublic void add(byte[] keyBytes)
BloomFilterBloomFilter.add in interface BloomFilterkeyBytes - the key bytes to the added to the BloomFilterpublic boolean mightContain(String key)
BloomFiltermightContain in interface BloomFilterkey - the key to be checked for membershiptrue if key may be found, false if key is not found for sure.public String serializeToString()
serializeToString in interface BloomFilterpublic void write(DataOutput out) throws IOException
IOExceptionpublic void readFields(DataInput in) throws IOException
IOExceptionpublic BloomFilterTypeCode getBloomFilterTypeCode()
getBloomFilterTypeCode in interface BloomFilterCopyright © 2024 The Apache Software Foundation. All rights reserved.