本文整理匯總了Java中org.apache.hadoop.hbase.io.ImmutableBytesWritable.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableBytesWritable.toString方法的具體用法?Java ImmutableBytesWritable.toString怎麽用?Java ImmutableBytesWritable.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.io.ImmutableBytesWritable
的用法示例。
在下文中一共展示了ImmutableBytesWritable.toString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPartition
import org.apache.hadoop.hbase.io.ImmutableBytesWritable; //導入方法依賴的package包/類
@Override
public int getPartition(final ImmutableBytesWritable key, final VALUE value,
final int reduces) {
if (reduces == 1) return 0;
if (this.lastReduces != reduces) {
this.splits = Bytes.split(this.startkey, this.endkey, reduces - 1);
for (int i = 0; i < splits.length; i++) {
LOG.info(Bytes.toStringBinary(splits[i]));
}
this.lastReduces = reduces;
}
int pos = Bytes.binarySearch(this.splits, key.get(), key.getOffset(),
key.getLength(), Bytes.BYTES_RAWCOMPARATOR);
// Below code is from hfile index search.
if (pos < 0) {
pos++;
pos *= -1;
if (pos == 0) {
// falls before the beginning of the file.
throw new RuntimeException("Key outside start/stop range: " +
key.toString());
}
pos--;
}
return pos;
}