Class SimpleSliceInputStream

java.lang.Object
io.trino.parquet.reader.SimpleSliceInputStream

public final class SimpleSliceInputStream extends Object
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 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)
    • 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 use getByteArrayOffset() 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.