public someClass implements RecordComparator {
public int compare( byte[ ] record1, byte[] record2 ) {
ByteArrayInputStream bais1 =
new ByteArrayInputStream( record1 );
DataInputStream dis1 = new DataInputStream( bais1 );
ByteArrayInputStream bais2 =
new ByteArrayInputStream( record2 );
DataInputStream dis2 = new DataInputStream( bais2 );
String name1 = dis1.readUTF( );
String name2 = dis.readUTF( );
int num = name1.compareTo( name2 );
if ( num > 0 ) {
return RecordComparator.FOLLOWS;
} else if ( num < 0 ) {
return recordcomparator.PRECEDES;
} else {
return recordcomparator.EQUIVALENT;
}
}
}
The three constants are defined in the