Add position checks in RunLenghtEncodedBlock
@@ -139,84 +139,98 @@ public class RunLengthEncodedBlock
@Override
public int getSliceLength(int position)
{
+ checkReadablePosition(position);
return value.getSliceLength(0);
}
@Override
public byte getByte(int position, int offset)
{
+ checkReadablePosition(position);
return value.getByte(0, offset);
}
@Override
public short getShort(int position, int offset)
{
+ checkReadablePosition(position);
return value.getShort(0, offset);
}
@Override
public int getInt(int position, int offset)
{
+ checkReadablePosition(position);
return value.getInt(0, offset);
}
@Override
public long getLong(int position, int offset)
{
+ checkReadablePosition(position);
return value.getLong(0, offset);
}
@Override
public Slice getSlice(int position, int offset, int length)
{
+ checkReadablePosition(position);
return value.getSlice(0, offset, length);
}
@Override
public <T> T getObject(int position, Class<T> clazz)
{
+ checkReadablePosition(position);
return value.getObject(0, clazz);
}
@Override
public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length)
{
+ checkReadablePosition(position);
return value.bytesEqual(0, offset, otherSlice, otherOffset, length);
}
@Override
public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength)
{
+ checkReadablePosition(position);
return value.bytesCompare(0, offset, length, otherSlice, otherOffset, otherLength);
}
@Override
public void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder)
{
+ checkReadablePosition(position);
value.writeBytesTo(0, offset, length, blockBuilder);
}
@Override
public void writePositionTo(int position, BlockBuilder blockBuilder)
{
+ checkReadablePosition(position);
value.writePositionTo(0, blockBuilder);
}
@Override
public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length)
{
+ checkReadablePosition(position);
return value.equals(0, offset, otherBlock, otherPosition, otherOffset, length);
}
@Override
public long hash(int position, int offset, int length)
{
+ checkReadablePosition(position);
return value.hash(0, offset, length);
}
@Override
public int compareTo(int leftPosition, int leftOffset, int leftLength, Block rightBlock, int rightPosition, int rightOffset, int rightLength)
{
+ checkReadablePosition(leftPosition);
return value.compareTo(0, leftOffset, leftLength, rightBlock, rightPosition, rightOffset, rightLength);
}
