Class BloomFilter
-
- All Implemented Interfaces:
-
java.io.Externalizable
,java.io.Serializable
,java.lang.Comparable
,org.apache.avro.generic.GenericContainer
,org.apache.avro.generic.GenericRecord
,org.apache.avro.generic.IndexedRecord
,org.apache.avro.specific.SpecificRecord
public class BloomFilter extends SpecificRecordBase implements SpecificRecord
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
BloomFilter.Builder
RecordBuilder for BloomFilter instances.
-
Field Summary
Fields Modifier and Type Field Description public final static Schema
SCHEMA$
public int
numberOfHashFunctions
public int
hashSeed
public int
filterLength
public ByteBuffer
filterBits
-
Constructor Summary
Constructors Constructor Description BloomFilter()
Default constructor. BloomFilter(Integer numberOfHashFunctions, Integer hashSeed, Integer filterLength, ByteBuffer filterBits)
All-args constructor.
-
Method Summary
Modifier and Type Method Description int
getNumberOfHashFunctions()
Gets the value of the 'numberOfHashFunctions' field. void
setNumberOfHashFunctions(int value)
Sets the value of the 'numberOfHashFunctions' field. int
getHashSeed()
Gets the value of the 'hashSeed' field. void
setHashSeed(int value)
Sets the value of the 'hashSeed' field. int
getFilterLength()
Gets the value of the 'filterLength' field. void
setFilterLength(int value)
Sets the value of the 'filterLength' field. ByteBuffer
getFilterBits()
Gets the value of the 'filterBits' field. void
setFilterBits(ByteBuffer value)
Sets the value of the 'filterBits' field. static Schema
getClassSchema()
static BinaryMessageEncoder<BloomFilter>
getEncoder()
Return the BinaryMessageEncoder instance used by this class. static BinaryMessageDecoder<BloomFilter>
getDecoder()
Return the BinaryMessageDecoder instance used by this class. static BinaryMessageDecoder<BloomFilter>
createDecoder(SchemaStore resolver)
Create a new BinaryMessageDecoder instance for this class that uses the specified SchemaStore. ByteBuffer
toByteBuffer()
Serializes this BloomFilter to a ByteBuffer. static BloomFilter
fromByteBuffer(ByteBuffer b)
Deserializes a BloomFilter from a ByteBuffer. SpecificData
getSpecificData()
Schema
getSchema()
Object
get(int field$)
void
put(int field$, Object value$)
static BloomFilter.Builder
newBuilder()
Creates a new BloomFilter RecordBuilder. static BloomFilter.Builder
newBuilder(BloomFilter.Builder other)
Creates a new BloomFilter RecordBuilder by copying an existing Builder. static BloomFilter.Builder
newBuilder(BloomFilter other)
Creates a new BloomFilter RecordBuilder by copying an existing BloomFilter instance. void
writeExternal(ObjectOutput out)
void
readExternal(ObjectInput in)
void
customEncode(Encoder out)
void
customDecode(ResolvingDecoder in)
-
Methods inherited from class org.apache.avro.specific.SpecificRecordBase
compareTo, equals, getConversion, hashCode, toString
-
Methods inherited from class org.apache.avro.generic.GenericRecord
hasField
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
BloomFilter
BloomFilter()
Default constructor.
-
BloomFilter
BloomFilter(Integer numberOfHashFunctions, Integer hashSeed, Integer filterLength, ByteBuffer filterBits)
All-args constructor.- Parameters:
numberOfHashFunctions
- The number of the hash functions.hashSeed
- The seed of the filter used for calculating the hashes, must change after each round.filterLength
- The length of the filter and size of the filterBits.filterBits
- ByteArray representation of the members present in the filter.
-
-
Method Detail
-
getNumberOfHashFunctions
int getNumberOfHashFunctions()
Gets the value of the 'numberOfHashFunctions' field.
-
setNumberOfHashFunctions
void setNumberOfHashFunctions(int value)
Sets the value of the 'numberOfHashFunctions' field. The number of the hash functions.
- Parameters:
value
- the value to set.
-
getHashSeed
int getHashSeed()
Gets the value of the 'hashSeed' field.
-
setHashSeed
void setHashSeed(int value)
Sets the value of the 'hashSeed' field. The seed of the filter used for calculating the hashes, must change after each round.
- Parameters:
value
- the value to set.
-
getFilterLength
int getFilterLength()
Gets the value of the 'filterLength' field.
-
setFilterLength
void setFilterLength(int value)
Sets the value of the 'filterLength' field. The length of the filter and size of the filterBits.
- Parameters:
value
- the value to set.
-
getFilterBits
ByteBuffer getFilterBits()
Gets the value of the 'filterBits' field.
-
setFilterBits
void setFilterBits(ByteBuffer value)
Sets the value of the 'filterBits' field. ByteArray representation of the members present in the filter.
- Parameters:
value
- the value to set.
-
getClassSchema
static Schema getClassSchema()
-
getEncoder
static BinaryMessageEncoder<BloomFilter> getEncoder()
Return the BinaryMessageEncoder instance used by this class.
-
getDecoder
static BinaryMessageDecoder<BloomFilter> getDecoder()
Return the BinaryMessageDecoder instance used by this class.
-
createDecoder
static BinaryMessageDecoder<BloomFilter> createDecoder(SchemaStore resolver)
Create a new BinaryMessageDecoder instance for this class that uses the specified SchemaStore.
- Parameters:
resolver
- a SchemaStore used to find schemas by fingerprint
-
toByteBuffer
ByteBuffer toByteBuffer()
Serializes this BloomFilter to a ByteBuffer.
-
fromByteBuffer
static BloomFilter fromByteBuffer(ByteBuffer b)
Deserializes a BloomFilter from a ByteBuffer.
- Parameters:
b
- a byte buffer holding serialized data for an instance of this class
-
getSpecificData
SpecificData getSpecificData()
-
getSchema
Schema getSchema()
-
newBuilder
static BloomFilter.Builder newBuilder()
Creates a new BloomFilter RecordBuilder.
-
newBuilder
static BloomFilter.Builder newBuilder(BloomFilter.Builder other)
Creates a new BloomFilter RecordBuilder by copying an existing Builder.
- Parameters:
other
- The existing builder to copy.
-
newBuilder
static BloomFilter.Builder newBuilder(BloomFilter other)
Creates a new BloomFilter RecordBuilder by copying an existing BloomFilter instance.
- Parameters:
other
- The existing instance to copy.
-
writeExternal
void writeExternal(ObjectOutput out)
-
readExternal
void readExternal(ObjectInput in)
-
customEncode
void customEncode(Encoder out)
-
customDecode
void customDecode(ResolvingDecoder in)
-
-
-
-