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:
larsh 2012-08-21 17:05:17 +00:00
parent 5ca25508d1
commit 94f8d617dd
2 changed files with 18 additions and 1 deletions

View File

@ -316,6 +316,21 @@ public class KeyValue implements Writable, HeapSize {
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 */
/**

View File

@ -606,7 +606,9 @@ public class HFileReaderV2 extends AbstractHFileReader {
return null;
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()) {
ret.setMemstoreTS(currMemstoreTS);
}