Class TempBufferHolder


  • public abstract class TempBufferHolder
    extends Object
    Manages a reference to a ByteBuffer.
    Author:
    James Ahlborn
    • Method Detail

      • getModCount

        public int getModCount()
        Returns:
        the modification count of the current buffer (this count is changed every time the buffer is reallocated)
      • newHolder

        public static TempBufferHolder newHolder​(TempBufferHolder.Type type,
                                                 boolean autoRewind)
        Creates a new TempBufferHolder.
        Parameters:
        type - the type of reference desired for any created buffer
        autoRewind - whether or not every get automatically rewinds the buffer
      • newHolder

        public static TempBufferHolder newHolder​(TempBufferHolder.Type type,
                                                 boolean autoRewind,
                                                 ByteOrder order)
        Creates a new TempBufferHolder.
        Parameters:
        type - the type of reference desired for any created buffer
        autoRewind - whether or not every get automatically rewinds the buffer
        order - byte order for all allocated buffers
      • getPageBuffer

        public final ByteBuffer getPageBuffer​(PageChannel pageChannel)
        Returns a ByteBuffer of at least the defined page size, with the limit set to the page size, and the predefined byteOrder. Will be rewound iff autoRewind is enabled for this buffer.
      • getBuffer

        public final ByteBuffer getBuffer​(PageChannel pageChannel,
                                          int size)
        Returns a ByteBuffer of at least the given size, with the limit set to the given size, and the predefined byteOrder. Will be rewound iff autoRewind is enabled for this buffer.
      • getExistingBuffer

        public abstract ByteBuffer getExistingBuffer()
        Returns:
        the currently referenced buffer, null if none
      • clear

        public abstract void clear()
        Releases any referenced memory.