Class PointerBuffer

  • All Implemented Interfaces:
    NativeBuffer<PointerBuffer>

    public class PointerBuffer
    extends AbstractBuffer<PointerBuffer>
    Hardware independent container for native pointer arrays. The native values (NIO direct ByteBuffer) might be 32bit or 64bit wide, depending of the CPU pointer width.
    Author:
    Sven Gothel, Michael Bien
    • Field Detail

      • ELEMENT_SIZE

        public static final int ELEMENT_SIZE
    • Method Detail

      • allocate

        public static PointerBuffer allocate​(int size)
        Returns a non direct PointerBuffer in native order, having a backup array
      • allocateDirect

        public static PointerBuffer allocateDirect​(int size)
        Returns a direct PointerBuffer in native order, w/o backup array
      • duplicate

        public final PointerBuffer duplicate()
        Returns:
        new PointerBuffer sharing the same buffer data of this instance (identity), but having an independent position.
      • put

        public final PointerBuffer put​(PointerBuffer src)
        Relative bulk get method. Copy the source values src[position .. capacity] [ to this buffer and increment the position by capacity-position.
      • get

        public final long get()
        Relative get method. Get the pointer value at the current position and increment the position by one.
      • get

        public final long get​(int idx)
        Absolute get method. Get the pointer value at the given index
      • get

        public final PointerBuffer get​(long[] dest,
                                       int offset,
                                       int length)
        Relative bulk get method. Copy the pointer values [ position .. position+length [ to the destination array [ dest[offset] .. dest[offset+length] [ and increment the position by length.
      • put

        public final PointerBuffer put​(int idx,
                                       long v)
        Absolute put method. Put the pointer value at the given index
      • put

        public final PointerBuffer put​(long value)
        Relative put method. Put the pointer value at the current position and increment the position by one.
      • put

        public final PointerBuffer put​(long[] src,
                                       int offset,
                                       int length)
        Relative bulk put method. Put the pointer values [ src[offset] .. src[offset+length] [ at the current position and increment the position by length.
      • referenceBuffer

        public final PointerBuffer referenceBuffer​(int index,
                                                   Buffer bb)
        Put the address of the given direct Buffer at the given position of this pointer array. Adding a reference of the given direct Buffer to this object.
        Throws:
        IllegalArgumentException - if bb is null or not a direct buffer
      • referenceBuffer

        public final PointerBuffer referenceBuffer​(Buffer bb)
        Put the address of the given direct Buffer at the end of this pointer array. Adding a reference of the given direct Buffer to this object.
      • getReferencedBuffer

        public final Buffer getReferencedBuffer​(int index)
      • getReferencedBuffer

        public final Buffer getReferencedBuffer()