| Modifier and Type | Field and Description |
|---|---|
static ByteOrder |
DEFAULT_BYTE_ORDER
default byte order of access mdb files
|
| Constructor and Description |
|---|
PageChannel(FileChannel channel,
boolean closeChannel,
JetFormat format,
boolean autoSync) |
| Modifier and Type | Method and Description |
|---|---|
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 |
readRootPage(ByteBuffer buffer) |
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
|
public static final ByteOrder DEFAULT_BYTE_ORDER
public PageChannel(FileChannel channel, boolean closeChannel, JetFormat format, boolean autoSync)
channel - Channel containing the databaseformat - Format of the database in the channelpublic 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)IOExceptionpublic void readRootPage(ByteBuffer buffer) throws IOException
buffer - Buffer to read the root page intoIOExceptionpublic void writePage(ByteBuffer page, int pageNumber) throws IOException
page - Page to writepageNumber - Page number to write the page toIOExceptionpublic 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 dataIOExceptionpublic int allocateNewPage()
throws IOException
writePage(ByteBuffer,int).IOExceptionpublic 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 FlushableIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionpublic static ByteBuffer narrowBuffer(ByteBuffer buffer, int position, int limit)
public static ByteBuffer wrap(byte[] bytes)
Copyright © 2005–2025 OpenHMS. All rights reserved.