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 Summary

    Constructors
    Constructor
    Description
    SimpleSliceInputStream(io.airlift.slice.Slice slice)
     
    SimpleSliceInputStream(io.airlift.slice.Slice slice, int offset)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.airlift.slice.Slice
     
    void
     
    byte[]
    Returns the byte array wrapped by this Slice.
    int
    Returns the start index the content of this slice within the byte array wrapped by this slice.
    byte
    getByteUnsafe(int index)
    Always check if needed data is available with ensureBytesAvailable method.
    int
    getIntUnsafe(int index)
    Always check if needed data is available with ensureBytesAvailable method.
    long
    getLongUnsafe(int index)
    Always check if needed data is available with ensureBytesAvailable method.
    byte
     
    byte[]
     
    void
    readBytes(byte[] output, int outputOffset, int length)
     
    void
    readBytes(io.airlift.slice.Slice destination, int destinationIndex, int length)
     
    int
     
    void
    readInts(int[] output, int outputOffset, int length)
     
    int
    Always check if needed data is available with ensureBytesAvailable method.
    long
     
    void
    readLongs(long[] output, int outputOffset, int length)
     
    long
    Always check if needed data is available with ensureBytesAvailable method.
    short
     
    void
    readShorts(short[] output, int outputOffset, int length)
     
    io.airlift.slice.Slice
    readSlice(int length)
     
    void
    skip(int n)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 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.