本文整理了Java中io.airlift.slice.Slice.getShort()
方法的一些代码示例,展示了Slice.getShort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slice.getShort()
方法的具体详情如下:
包路径:io.airlift.slice.Slice
类名称:Slice
方法名:getShort
[英]Gets a 16-bit short integer at the specified absolute index in this slice.
[中]获取此切片中指定绝对索引处的16位短整数。
代码示例来源:origin: prestodb/presto
@Override
public void decodeValueInto(BlockBuilder builder, Slice slice, int offset, int length)
{
type.writeLong(builder, Short.reverseBytes(slice.getShort(offset)));
}
}
代码示例来源:origin: prestodb/presto
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice(position).getShort(getPositionOffset(position) + offset);
}
代码示例来源:origin: prestodb/presto
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice().getShort(valueOffset(position) + offset);
}
代码示例来源:origin: prestodb/presto
private static void writeValues(Slice[] expectedValues, BlockBuilder blockBuilder)
{
for (Slice expectedValue : expectedValues) {
if (expectedValue == null) {
blockBuilder.appendNull();
}
else {
blockBuilder.writeShort(expectedValue.getShort(0)).closeEntry();
}
}
}
代码示例来源:origin: prestodb/presto
@Override
public Block decodeColumn(ColumnData columnData)
{
int size = columnData.rowCount();
BlockBuilder builder = type.createBlockBuilder(null, size);
Slice slice = columnData.getSlice();
for (int i = 0; i < size; i++) {
int length = columnData.getLength(i);
if (length != 0) {
checkState(length == SIZE_OF_SHORT, "Short should be 2 bytes");
type.writeLong(builder, (long) Short.reverseBytes(slice.getShort(columnData.getOffset(i))));
}
else {
builder.appendNull();
}
}
return builder.build();
}
代码示例来源:origin: prestodb/presto
assertEquals(block.getShort(position, offset), expectedSliceValue.getShort(offset));
代码示例来源:origin: airlift/slice
/**
* Gets an unsigned 16-bit short integer at the specified absolute {@code index}
* in this slice.
*
* @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
* {@code index + 2} is greater than {@code this.length()}
*/
public int getUnsignedShort(int index)
{
return getShort(index) & 0xFFFF;
}
代码示例来源:origin: io.airlift/slice
/**
* Gets an unsigned 16-bit short integer at the specified absolute {@code index}
* in this slice.
*
* @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
* {@code index + 2} is greater than {@code this.length()}
*/
public int getUnsignedShort(int index)
{
return getShort(index) & 0xFFFF;
}
代码示例来源:origin: airlift/slice
@Override
public short readShort()
{
short v = slice.getShort(position);
position += SIZE_OF_SHORT;
return v;
}
代码示例来源:origin: io.airlift/slice
@Override
public short readShort()
{
short v = slice.getShort(position);
position += SIZE_OF_SHORT;
return v;
}
代码示例来源:origin: airlift/slice
@Override
public short readShort()
{
ensureAvailable(SIZE_OF_SHORT);
short v = buffer.getShort(bufferPosition);
bufferPosition += SIZE_OF_SHORT;
return v;
}
代码示例来源:origin: io.airlift/slice
@Override
public short readShort()
{
ensureAvailable(SIZE_OF_SHORT);
short v = buffer.getShort(bufferPosition);
bufferPosition += SIZE_OF_SHORT;
return v;
}
代码示例来源:origin: com.facebook.presto/presto-rcfile
@Override
public void decodeValueInto(BlockBuilder builder, Slice slice, int offset, int length)
{
type.writeLong(builder, Short.reverseBytes(slice.getShort(offset)));
}
}
代码示例来源:origin: prestosql/presto
@Override
public void decodeValueInto(BlockBuilder builder, Slice slice, int offset, int length)
{
type.writeLong(builder, Short.reverseBytes(slice.getShort(offset)));
}
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice(position).getShort(getPositionOffset(position) + offset);
}
代码示例来源:origin: com.facebook.presto/presto-spi
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice().getShort(valueOffset(position) + offset);
}
代码示例来源:origin: prestosql/presto
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice().getShort(valueOffset(position) + offset);
}
代码示例来源:origin: prestosql/presto
@Override
public short getShort(int position, int offset)
{
checkReadablePosition(position);
return getRawSlice(position).getShort(getPositionOffset(position) + offset);
}
代码示例来源:origin: io.prestosql/presto-main
private static void writeValues(Slice[] expectedValues, BlockBuilder blockBuilder)
{
for (Slice expectedValue : expectedValues) {
if (expectedValue == null) {
blockBuilder.appendNull();
}
else {
blockBuilder.writeShort(expectedValue.getShort(0)).closeEntry();
}
}
}
代码示例来源:origin: prestosql/presto
private static void writeValues(Slice[] expectedValues, BlockBuilder blockBuilder)
{
for (Slice expectedValue : expectedValues) {
if (expectedValue == null) {
blockBuilder.appendNull();
}
else {
blockBuilder.writeShort(expectedValue.getShort(0)).closeEntry();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!