com.healthmarketscience.jackcess
Class TempBufferHolder

java.lang.Object
  extended by com.healthmarketscience.jackcess.TempBufferHolder

public abstract class TempBufferHolder
extends Object

Manages a reference to a ByteBuffer.

Author:
James Ahlborn

Nested Class Summary
static class TempBufferHolder.Type
          The caching type for the buffer holder.
 
Method Summary
abstract  void clear()
          Releases any referenced memory.
 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.
abstract  ByteBuffer getExistingBuffer()
           
 int getModCount()
           
 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.
static TempBufferHolder newHolder(TempBufferHolder.Type type, boolean autoRewind)
          Creates a new TempBufferHolder.
static TempBufferHolder newHolder(TempBufferHolder.Type type, boolean autoRewind, ByteOrder order)
          Creates a new TempBufferHolder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.



Copyright © 2005-2013 Health Market Science. All Rights Reserved.