Class InputStreamSliceInput

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()
      Returns the number of bytes that can be read without blocking.
      void close()  
      long getRetainedSize()
      Approximate number of bytes retained by this instance.
      boolean isReadable()
      Returns true if and only if available() is greater than 0.
      long position()
      Returns the position of this buffer.
      int read()  
      int read​(byte[] destination, int destinationIndex, int length)  
      boolean readBoolean()
      Returns true if the byte at the current position is not 0 and increases the position by 1 in this buffer.
      byte readByte()
      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 readDouble()
      Gets a 64-bit double at the current position and increases the position by 8 in this buffer.
      float readFloat()
      Gets a 32-bit float at the current position and increases the position by 4 in this buffer.
      int readInt()
      Gets a 32-bit integer at the current position and increases the position by 4 in this buffer.
      long readLong()
      Gets a 64-bit long at the current position and increases the position by 8 in this buffer.
      short readShort()
      Gets a 16-bit short integer at the current position and increases the position by 2 in this buffer.
      Slice 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 readUnsignedByte()
      Gets an unsigned byte at the current position and increases the position by 1 in this buffer.
      int readUnsignedShort()
      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)  
    • Constructor Detail

      • InputStreamSliceInput

        public InputStreamSliceInput​(InputStream inputStream)
      • InputStreamSliceInput

        public InputStreamSliceInput​(InputStream inputStream,
                                     int bufferSize)
    • Method Detail

      • 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
      • 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
      • 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
      • 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).
        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
      • getRetainedSize

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