HBASE-11561 deprecate ImmutableBytesWritable.getSize and replace with getLength

This commit is contained in:
Jonathan M Hsieh 2014-07-21 18:50:32 -07:00
parent 549a8ee219
commit 226672c55f
2 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ import org.apache.hadoop.io.WritableComparator;
/**
* A byte sequence that is usable as a key or value. Based on
* {@link org.apache.hadoop.io.BytesWritable} only this class is NOT resizable
* and DOES NOT distinguish between the size of the seqeunce and the current
* and DOES NOT distinguish between the size of the sequence and the current
* capacity as {@link org.apache.hadoop.io.BytesWritable} does. Hence its
* comparatively 'immutable'. When creating a new instance of this class,
* the underlying byte [] is not copied, just referenced. The backing
@ -71,7 +71,7 @@ implements WritableComparable<ImmutableBytesWritable> {
* @param ibw the value to set this ImmutableBytesWritable to.
*/
public ImmutableBytesWritable(final ImmutableBytesWritable ibw) {
this(ibw.get(), ibw.getOffset(), ibw.getSize());
this(ibw.get(), ibw.getOffset(), ibw.getLength());
}
/**
@ -119,7 +119,9 @@ implements WritableComparable<ImmutableBytesWritable> {
/**
* @return the number of valid bytes in the buffer
* @deprecated use {@link #getLength()} instead
*/
@Deprecated
public int getSize() {
if (this.bytes == null) {
throw new IllegalStateException("Uninitialiized. Null constructor " +
@ -131,8 +133,6 @@ implements WritableComparable<ImmutableBytesWritable> {
/**
* @return the number of valid bytes in the buffer
*/
//Should probably deprecate getSize() so that we keep the same calls for all
//byte []
public int getLength() {
if (this.bytes == null) {
throw new IllegalStateException("Uninitialiized. Null constructor " +

View File

@ -252,7 +252,7 @@ public class MapFilePerformanceEvaluation {
this.reader.next(key, value);
PerformanceEvaluationCommons.assertKey(this.key.get(),
format(i, this.verify).get());
PerformanceEvaluationCommons.assertValueSize(ROW_LENGTH, value.getSize());
PerformanceEvaluationCommons.assertValueSize(ROW_LENGTH, value.getLength());
}
@Override
@ -275,7 +275,7 @@ public class MapFilePerformanceEvaluation {
void doRow(int i) throws Exception {
ImmutableBytesWritable k = getRandomRow();
ImmutableBytesWritable r = (ImmutableBytesWritable)reader.get(k, value);
PerformanceEvaluationCommons.assertValueSize(r.getSize(), ROW_LENGTH);
PerformanceEvaluationCommons.assertValueSize(r.getLength(), ROW_LENGTH);
}
private ImmutableBytesWritable getRandomRow() {
@ -304,7 +304,7 @@ public class MapFilePerformanceEvaluation {
// TODO: Verify we're getting right values.
for (int ii = 0; ii < 29; ii++) {
this.reader.next(this.key, this.value);
PerformanceEvaluationCommons.assertValueSize(this.value.getSize(), ROW_LENGTH);
PerformanceEvaluationCommons.assertValueSize(this.value.getLength(), ROW_LENGTH);
}
}
@ -325,7 +325,7 @@ public class MapFilePerformanceEvaluation {
void doRow(int i) throws Exception {
ImmutableBytesWritable k = getGaussianRandomRow();
ImmutableBytesWritable r = (ImmutableBytesWritable)reader.get(k, value);
PerformanceEvaluationCommons.assertValueSize(r.getSize(), ROW_LENGTH);
PerformanceEvaluationCommons.assertValueSize(r.getLength(), ROW_LENGTH);
}
private ImmutableBytesWritable getGaussianRandomRow() {