本文整理了Java中io.airlift.slice.Slice.getInput()
方法的一些代码示例,展示了Slice.getInput()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slice.getInput()
方法的具体详情如下:
包路径:io.airlift.slice.Slice
类名称:Slice
方法名:getInput
[英]Creates a slice input backed by this slice. Any changes to this slice will be immediately visible to the slice input.
[中]创建由该切片支持的切片输入。对此切片的任何更改都将立即对切片输入可见。
代码示例来源:origin: prestodb/presto
public void setBuffers(Slice lengthsBuffer, Slice dataBuffer, int uncompressedDataSize)
{
this.lengthsInput = lengthsBuffer.getInput();
this.dataBuffer = dataBuffer;
this.uncompressedDataSize = uncompressedDataSize;
compressed = (decompressor != null);
currentPosition = 0;
currentOffset = 0;
runLength = 0;
lastValueLength = 0;
}
代码示例来源:origin: prestodb/presto
public static JsonParser createJsonParser(JsonFactory factory, Slice json)
throws IOException
{
// Jackson tries to detect the character encoding automatically when using InputStream
// so we pass an InputStreamReader instead.
return factory.createParser(new InputStreamReader(json.getInput(), UTF_8));
}
代码示例来源:origin: prestodb/presto
public static GeometrySerializationType deserializeType(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
return GeometrySerializationType.getForCode(input.readByte());
}
代码示例来源:origin: prestodb/presto
@Nullable
public static Envelope deserializeEnvelope(Slice shape)
{
requireNonNull(shape, "shape is null");
BasicSliceInput input = shape.getInput();
verify(input.available() > 0);
int length = input.available() - 1;
GeometrySerializationType type = GeometrySerializationType.getForCode(input.readByte());
return getEnvelope(input, type, length);
}
代码示例来源:origin: prestodb/presto
@Setup
public void setup()
{
byte[] bytes = new byte[256 * 64];
ThreadLocalRandom.current().nextBytes(bytes);
input = Slices.wrappedBuffer(bytes).getInput();
}
}
代码示例来源:origin: prestodb/presto
public StripeFooter readStripeFooter(StripeInformation stripe, AggregatedMemoryContext systemMemoryUsage)
throws IOException
{
long offset = stripe.getOffset() + stripe.getIndexLength() + stripe.getDataLength();
int tailLength = toIntExact(stripe.getFooterLength());
// read the footer
byte[] tailBuffer = new byte[tailLength];
orcDataSource.readFully(offset, tailBuffer);
try (InputStream inputStream = new OrcInputStream(orcDataSource.getId(), Slices.wrappedBuffer(tailBuffer).getInput(), decompressor, systemMemoryUsage, tailLength)) {
return metadataReader.readStripeFooter(types, inputStream);
}
}
代码示例来源:origin: prestodb/presto
public static FeatureUnitNormalizer deserialize(byte[] modelData)
{
SliceInput input = Slices.wrappedBuffer(modelData).getInput();
FeatureUnitNormalizer model = new FeatureUnitNormalizer();
while (input.isReadable()) {
int key = input.readInt();
model.mins.put(key, input.readDouble());
model.maxs.put(key, input.readDouble());
}
return model;
}
代码示例来源:origin: prestodb/presto
@Override
public void deserialize(Block block, int index, LongDecimalWithOverflowState state)
{
if (!block.isNull(index)) {
SliceInput slice = VARBINARY.getSlice(block, index).getInput();
state.setOverflow(slice.readLong());
state.setLongDecimal(Slices.copyOf(slice.readSlice(slice.available())));
}
}
}
代码示例来源:origin: prestodb/presto
private static Block copyBlock(Block block)
{
DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
BLOCK_ENCODING_SERDE.writeBlock(sliceOutput, block);
return BLOCK_ENCODING_SERDE.readBlock(sliceOutput.slice().getInput());
}
代码示例来源:origin: prestodb/presto
private static Block copyBlockViaBlockSerde(Block block)
{
DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
BLOCK_ENCODING_SERDE.writeBlock(sliceOutput, block);
return BLOCK_ENCODING_SERDE.readBlock(sliceOutput.slice().getInput());
}
代码示例来源:origin: prestodb/presto
@Override
public void deserialize(Block block, int index, LongDecimalWithOverflowAndLongState state)
{
if (!block.isNull(index)) {
SliceInput slice = VARBINARY.getSlice(block, index).getInput();
state.setLong(slice.readLong());
state.setOverflow(slice.readLong());
state.setLongDecimal(Slices.copyOf(slice.readSlice(slice.available())));
}
}
}
代码示例来源:origin: prestodb/presto
@Override
protected DecimalInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize());
return new DecimalInputStream(input);
}
代码示例来源:origin: prestodb/presto
@Override
protected LongInputStreamDwrf createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize());
return new LongInputStreamDwrf(input, LONG, true, true);
}
代码示例来源:origin: prestodb/presto
@Override
protected LongInputStreamV1 createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize());
return new LongInputStreamV1(input, true);
}
代码示例来源:origin: prestodb/presto
@Override
protected BooleanInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new BooleanInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
代码示例来源:origin: prestodb/presto
@Override
protected FloatInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new FloatInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
代码示例来源:origin: prestodb/presto
@Override
protected ByteInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new ByteInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
代码示例来源:origin: prestodb/presto
@Override
protected ByteArrayInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new ByteArrayInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
代码示例来源:origin: prestodb/presto
@Override
protected DecimalInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new DecimalInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
代码示例来源:origin: prestodb/presto
@Override
protected DoubleInputStream createValueStream(Slice slice)
throws OrcCorruptionException
{
Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE);
return new DoubleInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()));
}
内容来源于网络,如有侵权,请联系作者删除!