|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectnet.nutch.io.WritableComparator
A Comparator for WritableComparables.
This base implemenation uses the natural ordering. To define alternate
orderings, override compare(WritableComparable,WritableComparable).
One may optimize compare-intensive operations by overriding
compare(byte[],int,int,byte[],int,int). Static utility methods are
provided to assist in optimized implementations of this method.
| Constructor Summary | |
WritableComparator(Class keyClass)
Construct for a WritableComparable implementation. |
|
| Method Summary | |
int |
compare(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
Optimization hook. |
int |
compare(WritableComparable a,
WritableComparable b)
Compare two WritableComparables. |
static int |
compareBytes(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
Lexicographic order of binary data. |
Class |
getKeyClass()
Returns the WritableComparable implementation class. |
WritableComparable |
newKey()
Construct a new WritableComparable instance. |
static float |
readFloat(byte[] bytes,
int start)
Parse a float from a byte array. |
static int |
readInt(byte[] bytes,
int start)
Parse an integer from a byte array. |
static long |
readLong(byte[] bytes,
int start)
Parse a long from a byte array. |
static int |
readUnsignedShort(byte[] bytes,
int start)
Parse an unsigned short from a byte array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public WritableComparator(Class keyClass)
WritableComparable implementation.
| Method Detail |
public Class getKeyClass()
public WritableComparable newKey()
WritableComparable instance.
public int compare(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
The default implementation reads the data into two WritableComparables (using Writable.readFields(DataInput), then calls compare(WritableComparable,WritableComparable).
public int compare(WritableComparable a,
WritableComparable b)
The default implementation uses the natural ordering, calling Comparable.compareTo(Object).
public static int compareBytes(byte[] b1,
int s1,
int l1,
byte[] b2,
int s2,
int l2)
public static int readUnsignedShort(byte[] bytes,
int start)
public static int readInt(byte[] bytes,
int start)
public static float readFloat(byte[] bytes,
int start)
public static long readLong(byte[] bytes,
int start)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||