HBASE-6621 Reduce calls to Bytes.toInt
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1375663 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5ca25508d1
commit
94f8d617dd
@ -316,6 +316,21 @@ public class KeyValue implements Writable, HeapSize {
|
|||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a KeyValue from the specified byte array, starting at offset,
|
||||||
|
* for length <code>length</code>, and a known <code>keyLength</code>.
|
||||||
|
* @param bytes byte array
|
||||||
|
* @param offset offset to start of the KeyValue
|
||||||
|
* @param length length of the KeyValue
|
||||||
|
* @param keyLength length of the key portion of the KeyValue
|
||||||
|
*/
|
||||||
|
public KeyValue(final byte [] bytes, final int offset, final int length, final int keyLength) {
|
||||||
|
this.bytes = bytes;
|
||||||
|
this.offset = offset;
|
||||||
|
this.length = length;
|
||||||
|
this.keyLength = keyLength;
|
||||||
|
}
|
||||||
|
|
||||||
/** Constructors that build a new backing byte array from fields */
|
/** Constructors that build a new backing byte array from fields */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -606,7 +606,9 @@ public class HFileReaderV2 extends AbstractHFileReader {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
KeyValue ret = new KeyValue(blockBuffer.array(),
|
KeyValue ret = new KeyValue(blockBuffer.array(),
|
||||||
blockBuffer.arrayOffset() + blockBuffer.position());
|
blockBuffer.arrayOffset() + blockBuffer.position(),
|
||||||
|
KEY_VALUE_LEN_SIZE + currKeyLen + currValueLen,
|
||||||
|
currKeyLen);
|
||||||
if (this.reader.shouldIncludeMemstoreTS()) {
|
if (this.reader.shouldIncludeMemstoreTS()) {
|
||||||
ret.setMemstoreTS(currMemstoreTS);
|
ret.setMemstoreTS(currMemstoreTS);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user