org.apache.hadoop.io.serializer
Class DeserializerComparator<T>

java.lang.Object
  extended by org.apache.hadoop.io.serializer.DeserializerComparator<T>
Type Parameters:
T -
All Implemented Interfaces:
Comparator<T>, RawComparator<T>
Direct Known Subclasses:
JavaSerializationComparator

public abstract class DeserializerComparator<T>
extends Object
implements RawComparator<T>

A RawComparator that uses a Deserializer to deserialize the objects to be compared so that the standard Comparator can be used to compare them.

One may optimize compare-intensive operations by using a custom implementation of RawComparator that operates directly on byte representations.


Constructor Summary
protected DeserializerComparator(Deserializer<T> deserializer)
           
 
Method Summary
 int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Constructor Detail

DeserializerComparator

protected DeserializerComparator(Deserializer<T> deserializer)
                          throws IOException
Throws:
IOException
Method Detail

compare

public int compare(byte[] b1,
                   int s1,
                   int l1,
                   byte[] b2,
                   int s2,
                   int l2)
Specified by:
compare in interface RawComparator<T>


Copyright © 2009 The Apache Software Foundation