Package org.apache.hadoop.io
Class BinaryComparable
java.lang.Object
org.apache.hadoop.io.BinaryComparable
- All Implemented Interfaces:
Comparable<BinaryComparable>
- Direct Known Subclasses:
BytesWritable,Text
@Public
@Stable
public abstract class BinaryComparable
extends Object
implements Comparable<BinaryComparable>
Interface supported by
WritableComparable
types supporting ordering/permutation by a representative set of bytes.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(byte[] other, int off, int len) Compare bytes from {#getBytes()} to those provided.intcompareTo(BinaryComparable other) Compare bytes from {#getBytes()}.booleanReturn true if bytes from {#getBytes()} match.abstract byte[]getBytes()Return representative byte array for this instance.abstract intReturn n st bytes 0..n-1 from {#getBytes()} are valid.inthashCode()Return a hash of the bytes returned from {#getBytes()}.
-
Constructor Details
-
BinaryComparable
public BinaryComparable()
-
-
Method Details
-
getLength
public abstract int getLength()Return n st bytes 0..n-1 from {#getBytes()} are valid.- Returns:
- length.
-
getBytes
public abstract byte[] getBytes()Return representative byte array for this instance.- Returns:
- getBytes.
-
compareTo
Compare bytes from {#getBytes()}.- Specified by:
compareToin interfaceComparable<BinaryComparable>- See Also:
-
compareTo
public int compareTo(byte[] other, int off, int len) Compare bytes from {#getBytes()} to those provided.- Parameters:
other- other.off- off.len- len.- Returns:
- compareBytes.
-
equals
Return true if bytes from {#getBytes()} match. -
hashCode
public int hashCode()Return a hash of the bytes returned from {#getBytes()}.
-