Class InputStreamSliceInput

java.lang.Object
java.io.InputStream
io.airlift.slice.SliceInput
io.airlift.slice.InputStreamSliceInput
All Implemented Interfaces:
Closeable, DataInput, AutoCloseable

public final class InputStreamSliceInput extends SliceInput
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    InputStreamSliceInput(InputStream inputStream, int bufferSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of bytes that can be read without blocking.
    void
     
    long
    Approximate number of bytes retained by this instance.
    boolean
    Returns true if and only if available() is greater than 0.
    long
    Returns the position of this buffer.
    int
     
    int
    read(byte[] destination, int destinationIndex, int length)
     
    boolean
    Returns true if the byte at the current position is not 0 and increases the position by 1 in this buffer.
    byte
    Gets a byte at the current position and increases the position by 1 in this buffer.
    void
    readBytes(byte[] destination, int destinationIndex, int length)
    Transfers this buffer's data to the specified destination starting at the current position and increases the position by the number of the transferred bytes (= length).
    void
    readBytes(Slice destination, int destinationIndex, int length)
    Transfers this buffer's data to the specified destination starting at the current position and increases the position by the number of the transferred bytes (= length).
    void
    readBytes(OutputStream out, int length)
    Transfers this buffer's data to the specified stream starting at the current position.
    double
    Gets a 64-bit double at the current position and increases the position by 8 in this buffer.
    float
    Gets a 32-bit float at the current position and increases the position by 4 in this buffer.
    int
    Gets a 32-bit integer at the current position and increases the position by 4 in this buffer.
    long
    Gets a 64-bit long at the current position and increases the position by 8 in this buffer.
    short
    Gets a 16-bit short integer at the current position and increases the position by 2 in this buffer.
    readSlice(int length)
    Returns a new slice of this buffer's sub-region starting at the current position and increases the position by the size of the new slice (= length).
    int
    Gets an unsigned byte at the current position and increases the position by 1 in this buffer.
    int
    Gets an unsigned 16-bit short integer at the current position and increases the position by 2 in this buffer.
    void
    setPosition(long position)
    Sets the position of this buffer.
    long
    skip(long length)
     
    int
    skipBytes(int n)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InputStreamSliceInput

      public InputStreamSliceInput(InputStream inputStream)
    • InputStreamSliceInput

      public InputStreamSliceInput(InputStream inputStream, int bufferSize)
  • Method Details

    • position

      public long position()
      Description copied from class: SliceInput
      Returns the position of this buffer.
      Specified by:
      position in class SliceInput
    • setPosition

      public void setPosition(long position)
      Description copied from class: SliceInput
      Sets the position of this buffer.
      Specified by:
      setPosition in class SliceInput
    • available

      public int available()
      Description copied from class: SliceInput
      Returns the number of bytes that can be read without blocking.
      Specified by:
      available in class SliceInput
    • isReadable

      public boolean isReadable()
      Description copied from class: SliceInput
      Returns true if and only if available() is greater than 0.
      Specified by:
      isReadable in class SliceInput
    • skipBytes

      public int skipBytes(int n)
      Specified by:
      skipBytes in interface DataInput
      Specified by:
      skipBytes in class SliceInput
    • readBoolean

      public boolean readBoolean()
      Description copied from class: SliceInput
      Returns true if the byte at the current position is not 0 and increases the position by 1 in this buffer.
      Specified by:
      readBoolean in interface DataInput
      Specified by:
      readBoolean in class SliceInput
    • readByte

      public byte readByte()
      Description copied from class: SliceInput
      Gets a byte at the current position and increases the position by 1 in this buffer.
      Specified by:
      readByte in interface DataInput
      Specified by:
      readByte in class SliceInput
    • readUnsignedByte

      public int readUnsignedByte()
      Description copied from class: SliceInput
      Gets an unsigned byte at the current position and increases the position by 1 in this buffer.
      Specified by:
      readUnsignedByte in interface DataInput
      Specified by:
      readUnsignedByte in class SliceInput
    • readShort

      public short readShort()
      Description copied from class: SliceInput
      Gets a 16-bit short integer at the current position and increases the position by 2 in this buffer.
      Specified by:
      readShort in interface DataInput
      Specified by:
      readShort in class SliceInput
    • readUnsignedShort

      public int readUnsignedShort()
      Description copied from class: SliceInput
      Gets an unsigned 16-bit short integer at the current position and increases the position by 2 in this buffer.
      Specified by:
      readUnsignedShort in interface DataInput
      Specified by:
      readUnsignedShort in class SliceInput
    • readInt

      public int readInt()
      Description copied from class: SliceInput
      Gets a 32-bit integer at the current position and increases the position by 4 in this buffer.
      Specified by:
      readInt in interface DataInput
      Specified by:
      readInt in class SliceInput
    • readLong

      public long readLong()
      Description copied from class: SliceInput
      Gets a 64-bit long at the current position and increases the position by 8 in this buffer.
      Specified by:
      readLong in interface DataInput
      Specified by:
      readLong in class SliceInput
    • readFloat

      public float readFloat()
      Description copied from class: SliceInput
      Gets a 32-bit float at the current position and increases the position by 4 in this buffer.
      Specified by:
      readFloat in interface DataInput
      Specified by:
      readFloat in class SliceInput
    • readDouble

      public double readDouble()
      Description copied from class: SliceInput
      Gets a 64-bit double at the current position and increases the position by 8 in this buffer.
      Specified by:
      readDouble in interface DataInput
      Specified by:
      readDouble in class SliceInput
    • read

      public int read()
      Specified by:
      read in class SliceInput
    • skip

      public long skip(long length)
      Specified by:
      skip in class SliceInput
    • read

      public int read(byte[] destination, int destinationIndex, int length)
      Specified by:
      read in class SliceInput
    • readBytes

      public void readBytes(byte[] destination, int destinationIndex, int length)
      Description copied from class: SliceInput
      Transfers this buffer's data to the specified destination starting at the current position and increases the position by the number of the transferred bytes (= length).
      Specified by:
      readBytes in class SliceInput
      destinationIndex - the first index of the destination
      length - the number of bytes to transfer
    • readSlice

      public Slice readSlice(int length)
      Description copied from class: SliceInput
      Returns a new slice of this buffer's sub-region starting at the current position and increases the position by the size of the new slice (= length). The new slice could be either COMPACT or NOT_COMPACT.
      Specified by:
      readSlice in class SliceInput
      Parameters:
      length - the size of the new slice
      Returns:
      the newly created slice
    • readBytes

      public void readBytes(Slice destination, int destinationIndex, int length)
      Description copied from class: SliceInput
      Transfers this buffer's data to the specified destination starting at the current position and increases the position by the number of the transferred bytes (= length).
      Specified by:
      readBytes in class SliceInput
      destinationIndex - the first index of the destination
      length - the number of bytes to transfer
    • readBytes

      public void readBytes(OutputStream out, int length) throws IOException
      Description copied from class: SliceInput
      Transfers this buffer's data to the specified stream starting at the current position.
      Specified by:
      readBytes in class SliceInput
      length - the number of bytes to transfer
      Throws:
      IOException - if the specified stream threw an exception during I/O
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class SliceInput
    • getRetainedSize

      public long getRetainedSize()
      Description copied from class: SliceInput
      Approximate number of bytes retained by this instance.
      Specified by:
      getRetainedSize in class SliceInput