Class BufferByteArray.CursorImpl

java.lang.Object
org.apache.mina.util.byteaccess.BufferByteArray.CursorImpl
All Implemented Interfaces:
ByteArray.Cursor, IoRelativeReader, IoRelativeWriter
Enclosing class:
BufferByteArray

private class BufferByteArray.CursorImpl extends Object implements ByteArray.Cursor
  • Field Details

    • index

      private int index
  • Constructor Details

    • CursorImpl

      public CursorImpl()
    • CursorImpl

      public CursorImpl(int index)
  • Method Details

    • getRemaining

      public int getRemaining()
      Specified by:
      getRemaining in interface ByteArray.Cursor
      Specified by:
      getRemaining in interface IoRelativeReader
      Specified by:
      getRemaining in interface IoRelativeWriter
      Returns:
      the number of remaining bytes that can be read.
    • hasRemaining

      public boolean hasRemaining()
      Checks if there are any remaining bytes that can be read.
      Specified by:
      hasRemaining in interface ByteArray.Cursor
      Specified by:
      hasRemaining in interface IoRelativeReader
      Specified by:
      hasRemaining in interface IoRelativeWriter
      Returns:
      true if there are some remaining bytes in the buffer
    • 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.
    • order

      public ByteOrder order()
      Specified by:
      order in interface IoRelativeReader
      Specified by:
      order in interface IoRelativeWriter
      Returns:
      the bytes' order
    • 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
    • getInt

      public int getInt()
      Specified by:
      getInt in interface ByteArray.Cursor
      Specified by:
      getInt in interface IoRelativeReader
      Returns:
      an int and advances the reader.
    • 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