Package io.trino.parquet.reader
Class SimpleSliceInputStream
java.lang.Object
io.trino.parquet.reader.SimpleSliceInputStream
Basic input stream based on a given Slice object.
This is a simpler version of BasicSliceInput with a few additional methods.
Note that methods starting with 'read' modify the underlying offset, while 'get' methods return value without modifying the state
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleSliceInputStream(io.airlift.slice.Slice slice) SimpleSliceInputStream(io.airlift.slice.Slice slice, int offset) -
Method Summary
Modifier and TypeMethodDescriptionio.airlift.slice.SliceasSlice()voidensureBytesAvailable(int bytes) byte[]Returns the byte array wrapped by this Slice.intReturns the start index the content of this slice within the byte array wrapped by this slice.bytegetByteUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method.intgetIntUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method.longgetLongUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method.bytereadByte()byte[]voidreadBytes(byte[] output, int outputOffset, int length) voidreadBytes(io.airlift.slice.Slice destination, int destinationIndex, int length) intreadInt()voidreadInts(int[] output, int outputOffset, int length) intAlways check if needed data is available with ensureBytesAvailable method.longreadLong()voidreadLongs(long[] output, int outputOffset, int length) longAlways check if needed data is available with ensureBytesAvailable method.shortvoidreadShorts(short[] output, int outputOffset, int length) io.airlift.slice.SlicereadSlice(int length) voidskip(int n)
-
Constructor Details
-
SimpleSliceInputStream
public SimpleSliceInputStream(io.airlift.slice.Slice slice) -
SimpleSliceInputStream
public SimpleSliceInputStream(io.airlift.slice.Slice slice, int offset)
-
-
Method Details
-
readByte
public byte readByte() -
readShort
public short readShort() -
readInt
public int readInt() -
readLong
public long readLong() -
readBytes
public byte[] readBytes() -
readBytes
public void readBytes(byte[] output, int outputOffset, int length) -
readShorts
public void readShorts(short[] output, int outputOffset, int length) -
readInts
public void readInts(int[] output, int outputOffset, int length) -
readLongs
public void readLongs(long[] output, int outputOffset, int length) -
readBytes
public void readBytes(io.airlift.slice.Slice destination, int destinationIndex, int length) -
readSlice
public io.airlift.slice.Slice readSlice(int length) -
skip
public void skip(int n) -
asSlice
public io.airlift.slice.Slice asSlice() -
getByteArray
public byte[] getByteArray()Returns the byte array wrapped by this Slice. Callers should take care to usegetByteArrayOffset()since the contents of this Slice may not start at array index 0. -
getByteArrayOffset
public int getByteArrayOffset()Returns the start index the content of this slice within the byte array wrapped by this slice. -
ensureBytesAvailable
public void ensureBytesAvailable(int bytes) -
readIntUnsafe
public int readIntUnsafe()Always check if needed data is available with ensureBytesAvailable method. Failing to do so may result in instant JVM crash. -
readLongUnsafe
public long readLongUnsafe()Always check if needed data is available with ensureBytesAvailable method. Failing to do so may result in instant JVM crash. -
getByteUnsafe
public byte getByteUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method. Failing to do so may result in instant JVM crash. -
getIntUnsafe
public int getIntUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method. Failing to do so may result in instant JVM crash. -
getLongUnsafe
public long getLongUnsafe(int index) Always check if needed data is available with ensureBytesAvailable method. Failing to do so may result in instant JVM crash.
-