org.apache.hadoop.hbase.filter
Class BitComparator

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.ByteArrayComparable
      extended by org.apache.hadoop.hbase.filter.BitComparator
All Implemented Interfaces:
Comparable<byte[]>

@InterfaceAudience.Public
@InterfaceStability.Stable
public class BitComparator
extends ByteArrayComparable

A bit comparator which performs the specified bitwise operation on each of the bytes with the specified byte array. Then returns whether the result is non-zero.


Nested Class Summary
static class BitComparator.BitwiseOp
          Bit operators.
 
Field Summary
protected  BitComparator.BitwiseOp bitOperator
           
 
Constructor Summary
BitComparator(byte[] value, BitComparator.BitwiseOp bitOperator)
          Constructor
 
Method Summary
 int compareTo(byte[] value, int offset, int length)
          Special compareTo method for subclasses, to avoid copying byte[] unnecessarily.
 BitComparator.BitwiseOp getOperator()
           
static BitComparator parseFrom(byte[] pbBytes)
           
 byte[] toByteArray()
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.ByteArrayComparable
compareTo, getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bitOperator

protected BitComparator.BitwiseOp bitOperator
Constructor Detail

BitComparator

public BitComparator(byte[] value,
                     BitComparator.BitwiseOp bitOperator)
Constructor

Parameters:
value - value
bitOperator - operator to use on the bit comparison
Method Detail

getOperator

public BitComparator.BitwiseOp getOperator()
Returns:
the bitwise operator

toByteArray

public byte[] toByteArray()
Specified by:
toByteArray in class ByteArrayComparable
Returns:
The comparator serialized using pb

parseFrom

public static BitComparator parseFrom(byte[] pbBytes)
                               throws DeserializationException
Parameters:
pbBytes - A pb serialized BitComparator instance
Returns:
An instance of BitComparator made from bytes
Throws:
DeserializationException
See Also:
toByteArray()

compareTo

public int compareTo(byte[] value,
                     int offset,
                     int length)
Description copied from class: ByteArrayComparable
Special compareTo method for subclasses, to avoid copying byte[] unnecessarily.

Specified by:
compareTo in class ByteArrayComparable
Parameters:
value - byte[] to compare
offset - offset into value
length - number of bytes to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.


Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.