static int getKeyLength(Result r) { // Key length stored right before key as a short return Bytes.toShort(getRawBytes(r), getKeyOffset(r) - Bytes.SIZEOF_SHORT); }
public static void getKey(Result r, int offset, int length, ImmutableBytesWritable key) { key.set(getRawBytes(r), getKeyOffset(r) + offset, length); }
@Override public int compare(Result r1, Result r2) { byte[] r1Bytes = getRawBytes(r1); byte[] r2Bytes = getRawBytes(r2); return Bytes.compareTo(r1Bytes, getKeyOffset(r1), getKeyLength(r1), r2Bytes, getKeyOffset(r2), getKeyLength(r2)); }
public static int compareKeys(Result r1, Result r2) { return Bytes.compareTo(getRawBytes(r1), getKeyOffset(r1), getKeyLength(r1), getRawBytes(r2), getKeyOffset(r2), getKeyLength(r2)); }
public static KeyValue newKeyValue(Result r, byte[] cf, byte[] cq, long ts, byte[] value, int valueOffset, int valueLength) { byte[] bytes = ResultUtil.getRawBytes(r); return new KeyValue(bytes, ResultUtil.getKeyOffset(r), ResultUtil.getKeyLength(r), cf, 0, cf.length, cq, 0, cq.length, ts, Type.Put, value, valueOffset, valueLength); }
/** * Binary search for latest column value without allocating memory in the process */ public static KeyValue getColumnLatest(Result r, byte[] family, byte[] qualifier) { byte[] rbytes = getRawBytes(r); int roffset = getKeyOffset(r); int rlength = getKeyLength(r); return getColumnLatest(r, rbytes, roffset, rlength, family, 0, family.length, qualifier, 0, qualifier.length); }
/** * Return a pointer into a potentially much bigger byte buffer that points to the key of a Result. * Use offset to return a subset of the key bytes, for example to skip the organization ID embedded * in all of our keys. * @param r * @param offset offset added to start of key and subtracted from key length (to select subset of key bytes) */ public static ImmutableBytesWritable getKey(Result r, int offset) { return new ImmutableBytesWritable(getRawBytes(r), getKeyOffset(r) + offset, getKeyLength(r) - offset); }
public static KeyValue getSearchTerm(Result r, byte[] family, byte[] qualifier) { byte[] rbytes = getRawBytes(r); int roffset = getKeyOffset(r); int rlength = getKeyLength(r); return KeyValue.createFirstOnRow(rbytes, roffset, rlength, family, 0, family.length, qualifier, 0, qualifier.length); } /**