Example #1
0
    @SuppressWarnings("unchecked")
    protected boolean lessThan(Object a, Object b) {
      DataInputBuffer key1 = ((Segment<K, V>) a).getKey();
      DataInputBuffer key2 = ((Segment<K, V>) b).getKey();
      int s1 = key1.getPosition();
      int l1 = key1.getLength() - s1;
      int s2 = key2.getPosition();
      int l2 = key2.getLength() - s2;

      return comparator.compare(key1.getData(), s1, l1, key2.getData(), s2, l2) < 0;
    }
Example #2
0
 public void nextRawValue(DataInputBuffer value) throws IOException {
   final DataInputBuffer vb = kvIter.getValue();
   final int vp = vb.getPosition();
   final int vlen = vb.getLength() - vp;
   value.reset(vb.getData(), vp, vlen);
   bytesRead += vlen;
 }
Example #3
0
 public boolean nextRawKey(DataInputBuffer key) throws IOException {
   if (kvIter.next()) {
     final DataInputBuffer kb = kvIter.getKey();
     final int kp = kb.getPosition();
     final int klen = kb.getLength() - kp;
     key.reset(kb.getData(), kp, klen);
     bytesRead += klen;
     return true;
   }
   return false;
 }