@Override public int compareTo(int position, int offset, int length, Block otherBlock, int otherPosition, int otherOffset, int otherLength) { checkReadablePosition(position); if (fixedSize < length) { throw new IllegalArgumentException("Length longer than value length"); } int thisOffset = valueOffset(position) + offset; return -otherBlock.bytesCompare(otherPosition, otherOffset, otherLength, getRawSlice(), thisOffset, length); }
@Override public void writeBytesTo(int position, int offset, int length, BlockBuilder blockBuilder) { checkReadablePosition(position); blockBuilder.writeBytes(getRawSlice(), valueOffset(position) + offset, length); }
@Override public boolean equals(int position, int offset, Block otherBlock, int otherPosition, int otherOffset, int length) { checkReadablePosition(position); if (fixedSize < length) { return false; } int thisOffset = valueOffset(position) + offset; return otherBlock.bytesEqual(otherPosition, otherOffset, getRawSlice(), thisOffset, length); }
@Override public int getInt(int position, int offset) { checkReadablePosition(position); return getRawSlice().getInt(valueOffset(position) + offset); }
@Override public byte getByte(int position, int offset) { checkReadablePosition(position); return getRawSlice().getByte(valueOffset(position) + offset); }
@Override public short getShort(int position, int offset) { checkReadablePosition(position); return getRawSlice().getShort(valueOffset(position) + offset); }
@Override public long getLong(int position, int offset) { checkReadablePosition(position); return getRawSlice().getLong(valueOffset(position) + offset); }
@Override public Slice getSlice(int position, int offset, int length) { checkReadablePosition(position); return getRawSlice().slice(valueOffset(position) + offset, length); }
@Override public boolean bytesEqual(int position, int offset, Slice otherSlice, int otherOffset, int length) { checkReadablePosition(position); int thisOffset = valueOffset(position) + offset; return getRawSlice().equals(thisOffset, length, otherSlice, otherOffset, length); }
@Override public int bytesCompare(int position, int offset, int length, Slice otherSlice, int otherOffset, int otherLength) { checkReadablePosition(position); return getRawSlice().compareTo(valueOffset(position) + offset, length, otherSlice, otherOffset, otherLength); }
@Override public long hash(int position, int offset, int length) { checkReadablePosition(position); if (isNull(position)) { return 0; } return XxHash64.hash(getRawSlice(), valueOffset(position) + offset, length); }
@Override public Block getSingleValueBlock(int position) { checkReadablePosition(position); Slice copy = Slices.copyOf(getRawSlice(), valueOffset(position), fixedSize); Slice valueIsNull = null; if (isNull(position)) { valueIsNull = Slices.wrappedBooleanArray(true); } return new FixedWidthBlock(fixedSize, 1, copy, valueIsNull); }