|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.healthmarketscience.jackcess.impl.PageChannel
public class PageChannel
Reads and writes individual pages in a database file
| Constructor Summary | |
|---|---|
protected |
PageChannel(boolean testing)
Only used by unit tests |
|
PageChannel(FileChannel channel,
boolean closeChannel,
JetFormat format,
boolean autoSync)
|
| Method Summary | |
|---|---|
int |
allocateNewPage()
Allocates a new page in the database. |
void |
close()
|
static ByteBuffer |
createBuffer(int size)
|
static ByteBuffer |
createBuffer(int size,
ByteOrder order)
|
ByteBuffer |
createPageBuffer()
|
void |
deallocatePage(int pageNumber)
Deallocate a previously used page in the database. |
void |
finishWrite()
Completes a "logical" write operation. |
void |
flush()
|
JetFormat |
getFormat()
|
void |
initialize(DatabaseImpl database,
CodecProvider codecProvider)
Does second-stage initialization, must be called after construction. |
boolean |
isAutoSync()
|
boolean |
isOpen()
|
boolean |
isWriting()
Returns true if a logical write operation is in progress, false otherwise. |
static ByteBuffer |
narrowBuffer(ByteBuffer buffer,
int position,
int limit)
|
void |
readPage(ByteBuffer buffer,
int pageNumber)
|
void |
startExclusiveWrite()
Begins an exclusive "logical" write operation (throws an exception if another write operation is outstanding). |
void |
startWrite()
Begins a "logical" write operation. |
static ByteBuffer |
wrap(byte[] bytes)
Returns a ByteBuffer wrapping the given bytes and configured with the default byte order. |
void |
writePage(ByteBuffer page,
int pageNumber)
Write a page to disk |
void |
writePage(ByteBuffer page,
int pageNumber,
int pageOffset)
Write a page (or part of a page) to disk |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected PageChannel(boolean testing)
public PageChannel(FileChannel channel,
boolean closeChannel,
JetFormat format,
boolean autoSync)
throws IOException
channel - Channel containing the databaseformat - Format of the database in the channel
IOException| Method Detail |
|---|
public void initialize(DatabaseImpl database,
CodecProvider codecProvider)
throws IOException
IOExceptionpublic JetFormat getFormat()
public boolean isAutoSync()
public void startWrite()
finishWrite() for more
details.
public void startExclusiveWrite()
finishWrite() for
more details.
public void finishWrite()
throws IOException
startWrite() call). Logical write operations may be nested. If
the database is configured for "auto-sync", the channel will be flushed
when the outermost operation is complete,
IOExceptionpublic boolean isWriting()
true if a logical write operation is in progress, false otherwise.
public void readPage(ByteBuffer buffer,
int pageNumber)
throws IOException
buffer - Buffer to read the page intopageNumber - Number of the page to read in (starting at 0)
IOException
public void writePage(ByteBuffer page,
int pageNumber)
throws IOException
page - Page to writepageNumber - Page number to write the page to
IOException
public void writePage(ByteBuffer page,
int pageNumber,
int pageOffset)
throws IOException
page - Page to writepageNumber - Page number to write the page topageOffset - offset within the page at which to start writing the
page data
IOException
public int allocateNewPage()
throws IOException
writePage(ByteBuffer,int).
IOException
public void deallocatePage(int pageNumber)
throws IOException
IOExceptionpublic ByteBuffer createPageBuffer()
public static ByteBuffer createBuffer(int size)
public static ByteBuffer createBuffer(int size,
ByteOrder order)
public void flush()
throws IOException
flush in interface FlushableIOException
public void close()
throws IOException
close in interface Closeableclose in interface ChannelIOExceptionpublic boolean isOpen()
isOpen in interface Channel
public static ByteBuffer narrowBuffer(ByteBuffer buffer,
int position,
int limit)
public static ByteBuffer wrap(byte[] bytes)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||