本文整理汇总了Java中io.airlift.slice.Slice.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Slice.getInt方法的具体用法?Java Slice.getInt怎么用?Java Slice.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.airlift.slice.Slice
的用法示例。
在下文中一共展示了Slice.getInt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filterIds
import io.airlift.slice.Slice; //导入方法依赖的package包/类
private static int[] filterIds(ProjectionFunction projection, Page page, int[] selectedPositions)
{
Slice ids = ((DictionaryBlock) page.getBlock(getOnlyElement(projection.getInputChannels()))).getIds();
int[] outputIds = new int[selectedPositions.length];
for (int pos = 0; pos < selectedPositions.length; pos++) {
outputIds[pos] = ids.getInt(selectedPositions[pos] * SizeOf.SIZE_OF_INT);
}
return outputIds;
}
示例2: verifySlice
import io.airlift.slice.Slice; //导入方法依赖的package包/类
private static void verifySlice()
{
Slice slice = Slices.wrappedBuffer(new byte[5]);
slice.setByte(4, 0xDE);
slice.setByte(3, 0xAD);
slice.setByte(2, 0xBE);
slice.setByte(1, 0xEF);
if (slice.getInt(1) != 0xDEADBEEF) {
failRequirement("Slice library produced an unexpected result");
}
}
示例3: deserializeModels
import io.airlift.slice.Slice; //导入方法依赖的package包/类
public static List<Model> deserializeModels(byte[] bytes)
{
Slice slice = Slices.wrappedBuffer(bytes);
int numModels = slice.getInt(0);
int offset = SIZE_OF_INT + SIZE_OF_INT * numModels;
ImmutableList.Builder<Model> models = ImmutableList.builder();
for (int i = 0; i < numModels; i++) {
int length = slice.getInt(SIZE_OF_INT * (i + 1));
models.add(deserialize(slice.getBytes(offset, length)));
offset += length;
}
return models.build();
}
示例4: getIndex
import io.airlift.slice.Slice; //导入方法依赖的package包/类
private static int getIndex(Slice ids, int i)
{
return ids.getInt(i * SIZE_OF_INT);
}