com.healthmarketscience.jackcess.impl
Class TempPageHolder

java.lang.Object
  extended by com.healthmarketscience.jackcess.impl.TempPageHolder

public final class TempPageHolder
extends Object

Manages a reference to a page buffer.

Author:
James Ahlborn

Method Summary
 void clear()
          Forces any current page data to be disregarded (any getPage/setPage call must reload page data) and releases any referenced memory.
 ByteBuffer getPage(PageChannel pageChannel)
           
 int getPageNumber()
           
 void invalidate()
          Forces any current page data to be disregarded (any getPage/setPage call must reload page data).
static TempPageHolder newHolder(TempBufferHolder.Type type)
          Creates a new TempPageHolder.
 void possiblyInvalidate(int modifiedPageNumber, ByteBuffer modifiedBuffer)
          Forces any current page data to be disregarded if it matches the given page number (any getPage/setPage call must reload page data) and is not the given buffer.
 ByteBuffer setNewPage(PageChannel pageChannel)
          Allocates a new buffer in the database (with undefined data) and returns a new empty buffer.
 ByteBuffer setPage(PageChannel pageChannel, int pageNumber)
          Sets the current page number and returns that page
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newHolder

public static TempPageHolder newHolder(TempBufferHolder.Type type)
Creates a new TempPageHolder.

Parameters:
type - the type of reference desired for any create page buffers

getPageNumber

public int getPageNumber()
Returns:
the currently set page number

getPage

public ByteBuffer getPage(PageChannel pageChannel)
                   throws IOException
Returns:
the page for the current page number, reading as necessary, position and limit are unchanged
Throws:
IOException

setPage

public ByteBuffer setPage(PageChannel pageChannel,
                          int pageNumber)
                   throws IOException
Sets the current page number and returns that page

Returns:
the page for the new page number, reading as necessary, resets position
Throws:
IOException

setNewPage

public ByteBuffer setNewPage(PageChannel pageChannel)
                      throws IOException
Allocates a new buffer in the database (with undefined data) and returns a new empty buffer.

Throws:
IOException

invalidate

public void invalidate()
Forces any current page data to be disregarded (any getPage/setPage call must reload page data). Does not necessarily release any memory.


possiblyInvalidate

public void possiblyInvalidate(int modifiedPageNumber,
                               ByteBuffer modifiedBuffer)
Forces any current page data to be disregarded if it matches the given page number (any getPage/setPage call must reload page data) and is not the given buffer. Does not necessarily release any memory.


clear

public void clear()
Forces any current page data to be disregarded (any getPage/setPage call must reload page data) and releases any referenced memory.



Copyright © 2005–2017 Health Market Science. All rights reserved.