/** * Copy the key into BytesWritable. The input BytesWritable will be * automatically resized to the actual key size. * * @param key * BytesWritable to hold the key. * @throws IOException */ public int getKey(BytesWritable key) throws IOException { key.setSize(getKeyLength()); getKey(key.getBytes()); return key.getLength(); }
@Override public int hashCode() { return WritableComparator.hashBytes(keyBuffer, getKeyLength()); } }
/** * Compare an entry with a RawComparable object. This is useful when * Entries are stored in a collection, and we want to compare a user * supplied key. */ @Override public int compareTo(RawComparable key) { return reader.compareKeys(keyBuffer, 0, getKeyLength(), key.buffer(), key.offset(), key.size()); }
public byte[] readKey(Scanner scanner) throws IOException { int keylen = scanner.entry().getKeyLength(); byte[] read = new byte[keylen]; scanner.entry().getKey(read); return read; }
@Override public int hashCode() { return WritableComparator.hashBytes(keyBuffer, 0, getKeyLength()); } }
public byte[] readKey(Scanner scanner) throws IOException { int keylen = scanner.entry().getKeyLength(); byte[] read = new byte[keylen]; scanner.entry().getKey(read); return read; }
@Override public int hashCode() { return WritableComparator.hashBytes(keyBuffer, 0, getKeyLength()); } }
/** * Compare whether this and other points to the same key value. */ @Override public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof Entry)) return false; return ((Entry) other).compareTo(keyBuffer, 0, getKeyLength()) == 0; }
/** * Provide a customized comparator for Entries. This is useful if we * have a collection of Entry objects. However, if the Entry objects * come from different TFiles, users must ensure that those TFiles share * the same RawComparator. */ @Override public int compare(Scanner.Entry o1, Scanner.Entry o2) { return comparator.compare(o1.getKeyBuffer(), 0, o1.getKeyLength(), o2 .getKeyBuffer(), 0, o2.getKeyLength()); } };
/** * Compare an entry with a RawComparable object. This is useful when * Entries are stored in a collection, and we want to compare a user * supplied key. */ @Override public int compareTo(RawComparable key) { return reader.compareKeys(keyBuffer, 0, getKeyLength(), key.buffer(), key.offset(), key.size()); }
/** * Compare an entry with a RawComparable object. This is useful when * Entries are stored in a collection, and we want to compare a user * supplied key. */ @Override public int compareTo(RawComparable key) { return reader.compareKeys(keyBuffer, 0, getKeyLength(), key.buffer(), key.offset(), key.size()); }
/** * Provide a customized comparator for Entries. This is useful if we * have a collection of Entry objects. However, if the Entry objects * come from different TFiles, users must ensure that those TFiles share * the same RawComparator. */ @Override public int compare(Scanner.Entry o1, Scanner.Entry o2) { return comparator.compare(o1.getKeyBuffer(), 0, o1.getKeyLength(), o2 .getKeyBuffer(), 0, o2.getKeyLength()); } };
/** * Compare whether this and other points to the same key value. */ @Override public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof Entry)) return false; return ((Entry) other).compareTo(keyBuffer, 0, getKeyLength()) == 0; }
/** * Provide a customized comparator for Entries. This is useful if we * have a collection of Entry objects. However, if the Entry objects * come from different TFiles, users must ensure that those TFiles share * the same RawComparator. */ @Override public int compare(Scanner.Entry o1, Scanner.Entry o2) { return comparator.compare(o1.getKeyBuffer(), 0, o1.getKeyLength(), o2 .getKeyBuffer(), 0, o2.getKeyLength()); } };
/** * Provide a customized comparator for Entries. This is useful if we * have a collection of Entry objects. However, if the Entry objects * come from different TFiles, users must ensure that those TFiles share * the same RawComparator. */ @Override public int compare(Scanner.Entry o1, Scanner.Entry o2) { return comparator.compare(o1.getKeyBuffer(), 0, o1.getKeyLength(), o2 .getKeyBuffer(), 0, o2.getKeyLength()); } };
/** * Compare whether this and other points to the same key value. */ @Override public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof Entry)) return false; return ((Entry) other).compareTo(keyBuffer, 0, getKeyLength()) == 0; }
/** * Compare whether this and other points to the same key value. */ @Override public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof Entry)) return false; return ((Entry) other).compareTo(keyBuffer, 0, getKeyLength()) == 0; }
@Override public int hashCode() { return WritableComparator.hashBytes(keyBuffer, 0, getKeyLength()); } }
/** * Compare an entry with a RawComparable object. This is useful when * Entries are stored in a collection, and we want to compare a user * supplied key. */ @Override public int compareTo(RawComparable key) { return reader.compareKeys(keyBuffer, 0, getKeyLength(), key.buffer(), key.offset(), key.size()); }
/** * Provide a customized comparator for Entries. This is useful if we * have a collection of Entry objects. However, if the Entry objects * come from different TFiles, users must ensure that those TFiles share * the same RawComparator. */ @Override public int compare(Scanner.Entry o1, Scanner.Entry o2) { return comparator.compare(o1.getKeyBuffer(), 0, o1.getKeyLength(), o2 .getKeyBuffer(), 0, o2.getKeyLength()); } };