Class BufferByteArray.CursorImpl

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index  
    • Constructor Summary

      Constructors 
      Constructor Description
      CursorImpl()  
      CursorImpl​(int index)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte get()
      void get​(IoBuffer bb)
      Gets enough bytes to fill the IoBuffer and advances the reader.
      char getChar()
      double getDouble()
      float getFloat()
      int getIndex()
      int getInt()
      long getLong()
      int getRemaining()
      short getShort()
      boolean hasRemaining()
      Checks if there are any remaining bytes that can be read.
      java.nio.ByteOrder order()
      void put​(byte b)
      Puts a byte and advances the reader.
      void put​(IoBuffer bb)
      Puts enough bytes to fill the IoBuffer and advances the reader.
      void putChar​(char c)
      Puts a char and advances the reader.
      void putDouble​(double d)
      Puts a double and advances the reader.
      void putFloat​(float f)
      Puts a float and advances the reader.
      void putInt​(int i)
      Puts an int and advances the reader.
      void putLong​(long l)
      Puts a long and advances the reader.
      void putShort​(short s)
      Puts a short and advances the reader.
      void setIndex​(int index)
      Sets the current index of the cursor.
      void skip​(int length)
      Advances the reader by the given number of bytes.
      ByteArray slice​(int length)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • index

        private int index
    • Constructor Detail

      • CursorImpl

        public CursorImpl()
      • CursorImpl

        public CursorImpl​(int index)
    • Method Detail

      • getIndex

        public int getIndex()
        Specified by:
        getIndex in interface ByteArray.Cursor
        Returns:
        the current index of the cursor.
      • setIndex

        public void setIndex​(int index)
        Sets the current index of the cursor. No bounds checking will occur until an access occurs.
        Specified by:
        setIndex in interface ByteArray.Cursor
        Parameters:
        index - The current index to set
      • skip

        public void skip​(int length)
        Advances the reader by the given number of bytes.
        Specified by:
        skip in interface IoRelativeReader
        Specified by:
        skip in interface IoRelativeWriter
        Parameters:
        length - the number of bytes to skip
      • slice

        public ByteArray slice​(int length)
        Specified by:
        slice in interface IoRelativeReader
        Parameters:
        length - The number of bytes to get
        Returns:
        an array with a view of part of this array.
      • get

        public byte get()
        Specified by:
        get in interface ByteArray.Cursor
        Specified by:
        get in interface IoRelativeReader
        Returns:
        the byte at the current position and advances the reader.
      • put

        public void put​(byte b)
        Puts a byte and advances the reader.
        Specified by:
        put in interface IoRelativeWriter
        Parameters:
        b - The byte to put
      • get

        public void get​(IoBuffer bb)
        Gets enough bytes to fill the IoBuffer and advances the reader.
        Specified by:
        get in interface ByteArray.Cursor
        Specified by:
        get in interface IoRelativeReader
        Parameters:
        bb - The IoBuffer that will contain the read bytes
      • put

        public void put​(IoBuffer bb)
        Puts enough bytes to fill the IoBuffer and advances the reader.
        Specified by:
        put in interface IoRelativeWriter
        Parameters:
        bb - The bytes to put
      • getShort

        public short getShort()
        Specified by:
        getShort in interface IoRelativeReader
        Returns:
        a short and advances the reader.
      • putShort

        public void putShort​(short s)
        Puts a short and advances the reader.
        Specified by:
        putShort in interface IoRelativeWriter
        Parameters:
        s - The short to put
      • putInt

        public void putInt​(int i)
        Puts an int and advances the reader.
        Specified by:
        putInt in interface IoRelativeWriter
        Parameters:
        i - The int to put
      • getLong

        public long getLong()
        Specified by:
        getLong in interface IoRelativeReader
        Returns:
        a long and advances the reader.
      • putLong

        public void putLong​(long l)
        Puts a long and advances the reader.
        Specified by:
        putLong in interface IoRelativeWriter
        Parameters:
        l - The long to put
      • getFloat

        public float getFloat()
        Specified by:
        getFloat in interface IoRelativeReader
        Returns:
        a float and advances the reader.
      • putFloat

        public void putFloat​(float f)
        Puts a float and advances the reader.
        Specified by:
        putFloat in interface IoRelativeWriter
        Parameters:
        f - The float to put
      • getDouble

        public double getDouble()
        Specified by:
        getDouble in interface IoRelativeReader
        Returns:
        a double and advances the reader.
      • putDouble

        public void putDouble​(double d)
        Puts a double and advances the reader.
        Specified by:
        putDouble in interface IoRelativeWriter
        Parameters:
        d - The double to put
      • getChar

        public char getChar()
        Specified by:
        getChar in interface IoRelativeReader
        Returns:
        a char and advances the reader.
      • putChar

        public void putChar​(char c)
        Puts a char and advances the reader.
        Specified by:
        putChar in interface IoRelativeWriter
        Parameters:
        c - The char to put