Class ByteBufferIndexer

All Implemented Interfaces:
AutoCloseable

public class ByteBufferIndexer extends ByteIndexer
An indexer for a ByteBuffer.
  • Field Details

    • buffer

      protected ByteBuffer buffer
      The backing buffer.
  • Constructor Details

    • ByteBufferIndexer

      public ByteBufferIndexer(ByteBuffer buffer)
      Calls ByteBufferIndexer(buffer, Index.create(buffer.limit())).
    • ByteBufferIndexer

      public ByteBufferIndexer(ByteBuffer buffer, long... sizes)
      Calls ByteBufferIndexer(buffer, Index.create(sizes)).
    • ByteBufferIndexer

      public ByteBufferIndexer(ByteBuffer buffer, long[] sizes, long[] strides)
      Calls ByteBufferIndexer(buffer, Index.create(sizes, strides)).
    • ByteBufferIndexer

      public ByteBufferIndexer(ByteBuffer buffer, Index index)
      Constructor to set the buffer and Indexer.index.
  • Method Details

    • buffer

      public Buffer buffer()
      Description copied from class: Indexer
      Returns the backing buffer, or null if none
      Overrides:
      buffer in class Indexer
    • reindex

      public ByteIndexer reindex(Index index)
      Description copied from class: Indexer
      Returns a new Indexer using the same data, but with a different Index.
      Specified by:
      reindex in class Indexer
    • get

      public byte get(long i)
      Description copied from class: ByteIndexer
      Returns array/buffer[index(i)]
      Specified by:
      get in class ByteIndexer
    • get

      public ByteIndexer get(long i, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where b[offset:offset + length] = array/buffer[index(i)]
      Specified by:
      get in class ByteIndexer
    • get

      public byte get(long i, long j)
      Description copied from class: ByteIndexer
      Returns array/buffer[index(i, j)]
      Specified by:
      get in class ByteIndexer
    • get

      public ByteIndexer get(long i, long j, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where b[offset:offset + length] = array/buffer[index(i, j)]
      Specified by:
      get in class ByteIndexer
    • get

      public byte get(long i, long j, long k)
      Description copied from class: ByteIndexer
      Returns array/buffer[index(i, j, k)]
      Specified by:
      get in class ByteIndexer
    • get

      public byte get(long... indices)
      Description copied from class: ByteIndexer
      Returns array/buffer[index(indices)]
      Specified by:
      get in class ByteIndexer
    • get

      public ByteIndexer get(long[] indices, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where b[offset:offset + length] = array/buffer[index(indices)]
      Specified by:
      get in class ByteIndexer
    • put

      public ByteIndexer put(long i, byte b)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(i)] = b
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long i, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(i)] = b[offset:offset + length]
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long i, long j, byte b)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(i, j)] = b
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long i, long j, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(i, j)] = b[offset:offset + length]
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long i, long j, long k, byte b)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(i, j, k)] = b
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long[] indices, byte b)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(indices)] = b
      Specified by:
      put in class ByteIndexer
    • put

      public ByteIndexer put(long[] indices, byte[] b, int offset, int length)
      Description copied from class: ByteIndexer
      Returns this where array/buffer[index(indices)] = b[offset:offset + length]
      Specified by:
      put in class ByteIndexer
    • getByte

      public byte getByte(long i)
      Description copied from class: ByteIndexer
      Returns the byte value at array/buffer[i]
      Specified by:
      getByte in class ByteIndexer
    • putByte

      public ByteIndexer putByte(long i, byte b)
      Description copied from class: ByteIndexer
      Sets the byte value at array/buffer[i]
      Specified by:
      putByte in class ByteIndexer
    • getShort

      public short getShort(long i)
      Description copied from class: ByteIndexer
      Returns the short value at array/buffer[i]
      Specified by:
      getShort in class ByteIndexer
    • putShort

      public ByteIndexer putShort(long i, short s)
      Description copied from class: ByteIndexer
      Sets the short value at array/buffer[i]
      Specified by:
      putShort in class ByteIndexer
    • getInt

      public int getInt(long i)
      Description copied from class: ByteIndexer
      Returns the int value at array/buffer[i]
      Specified by:
      getInt in class ByteIndexer
    • putInt

      public ByteIndexer putInt(long i, int j)
      Description copied from class: ByteIndexer
      Sets the int value at array/buffer[i]
      Specified by:
      putInt in class ByteIndexer
    • getLong

      public long getLong(long i)
      Description copied from class: ByteIndexer
      Returns the long value at array/buffer[i]
      Specified by:
      getLong in class ByteIndexer
    • putLong

      public ByteIndexer putLong(long i, long j)
      Description copied from class: ByteIndexer
      Sets the long value at array/buffer[i]
      Specified by:
      putLong in class ByteIndexer
    • getFloat

      public float getFloat(long i)
      Description copied from class: ByteIndexer
      Returns the float value at array/buffer[i]
      Specified by:
      getFloat in class ByteIndexer
    • putFloat

      public ByteIndexer putFloat(long i, float f)
      Description copied from class: ByteIndexer
      Sets the float value at array/buffer[i]
      Specified by:
      putFloat in class ByteIndexer
    • getDouble

      public double getDouble(long i)
      Description copied from class: ByteIndexer
      Returns the double value at array/buffer[i]
      Specified by:
      getDouble in class ByteIndexer
    • putDouble

      public ByteIndexer putDouble(long i, double d)
      Description copied from class: ByteIndexer
      Sets the double value at array/buffer[i]
      Specified by:
      putDouble in class ByteIndexer
    • getChar

      public char getChar(long i)
      Description copied from class: ByteIndexer
      Returns the char value at array/buffer[i]
      Specified by:
      getChar in class ByteIndexer
    • putChar

      public ByteIndexer putChar(long i, char c)
      Description copied from class: ByteIndexer
      Sets the char value at array/buffer[i]
      Specified by:
      putChar in class ByteIndexer
    • release

      public void release()
      Description copied from class: Indexer
      Makes sure changes are reflected onto the backing memory and clears any references.
      Specified by:
      release in class Indexer