| Modifier and Type | Field and Description |
|---|---|
| private final boolean | autoSync
whether or not to force all writes to disk immediately |
| private final FileChannel | channel
Channel containing the database |
| private final boolean | closeChannel
whether or not the channel should be closed by this class |
| private CodecHandler | codecHandler
handler for the current database encoding type |
| public static final ByteOrder | DEFAULT_BYTE_ORDER
default byte order of access mdb files |
| private final ByteBuffer | forceBytes
dummy buffer used when allocating new pages |
| private final JetFormat | format
Format of the database in the channel |
| private TempPageHolder | fullPageEncodeBufferH
temp page buffer used when pages cannot be partially encoded |
| private UsageMap | globalUsageMap
Tracks free pages in the database. |
| private static final byte[] | INVALID_PAGE_BYTE_HEADER
invalid page header, used when deallocating old pages. |
| pack-priv static final int | |
| private final ByteBuffer | invalidPageBytes
buffer used when deallocating old pages. |
| private long | knownFileSize
Cached size of the channel, in bytes. |
| pack-priv static final int | PAGE_GLOBAL_USAGE_MAP
Global usage map always lives on page 1 |
| pack-priv static final int | ROW_GLOBAL_USAGE_MAP
Global usage map always lives at row 0 |
| private TempBufferHolder | |
| private int |
| Access | Constructor and Description |
|---|---|
| protected | |
| public | PageChannel(FileChannel
Channel containing the database channel, boolean closeChannel, JetFormat Format of the database in the channel format, boolean autoSync)
|
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| private void | |
| private void | |
| public void | |
| public static ByteBuffer | Returns: A newly-allocated buffer of the given size and DEFAULT_BYTE_ORDER byte orderReturns a newly-allocated buffer of the given size and DEFAULT_BYTE_ORDER byte order. |
| public static ByteBuffer | Returns: A newly-allocated buffer of the given size and byte orderReturns a newly-allocated buffer of the given size and byte order. |
| public ByteBuffer | Returns: A newly-allocated buffer that can be passed to readPageReturns a newly-allocated buffer that can be passed to readPage. |
| public void | |
| public void | |
| public void | flush()
Implements java. Flushes this stream by writing any buffered output to the underlying stream. |
| private long | getFileSize()
Returns: the current channel size, in bytes, tracked locally instead of queried from the OS on every call |
| public JetFormat | |
| private int | |
| private long | |
| public void | initialize(DatabaseImpl database, CodecProvider codecProvider)
Does second-stage initialization, must be called after construction. |
| public boolean | |
| public boolean | |
| public boolean | |
| public static ByteBuffer | Returns: a duplicate of the current buffer narrowed to the given position and limit. mark will be set at the current position.Returns a duplicate of the current buffer narrowed to the given position and limit. |
| public void | readPage(ByteBuffer
Buffer to read the page into buffer, int Number of the page to read in (starting at 0) pageNumber)Reads the given page into the buffer, decoding it if necessary. |
| public void | readRootPage(ByteBuffer
Buffer to read the root page into buffer)Reads the root page into the buffer; this works before the channel is fully initialized. |
| public void | startExclusiveWrite()
Begins an exclusive "logical" write operation (throws an exception if another write operation is outstanding). |
| public void | |
| private void | |
| public static ByteBuffer | wrap(byte[] bytes)
Returns a ByteBuffer wrapping the given bytes and configured with the default byte order. |
| public void | writePage(ByteBuffer
Page to write page, int Page number to write the page to pageNumber)Write a page to disk |
| public void | writePage(ByteBuffer
Page to write page, int Page number to write the page to pageNumber, int offset within the page at which to start writing the page data pageOffset)Write a page (or part of a page) to disk |
| autoSync | back to summary |
|---|---|
| private final boolean autoSync whether or not to force all writes to disk immediately | |
| channel | back to summary |
|---|---|
| private final FileChannel channel Channel containing the database | |
| closeChannel | back to summary |
|---|---|
| private final boolean closeChannel whether or not the channel should be closed by this class | |
| codecHandler | back to summary |
|---|---|
| private CodecHandler codecHandler handler for the current database encoding type | |
| DEFAULT_BYTE_ORDER | back to summary |
|---|---|
| public static final ByteOrder DEFAULT_BYTE_ORDER default byte order of access mdb files | |
| forceBytes | back to summary |
|---|---|
| private final ByteBuffer forceBytes dummy buffer used when allocating new pages | |
| format | back to summary |
|---|---|
| private final JetFormat format Format of the database in the channel | |
| fullPageEncodeBufferH | back to summary |
|---|---|
| private TempPageHolder fullPageEncodeBufferH temp page buffer used when pages cannot be partially encoded | |
| globalUsageMap | back to summary |
|---|---|
| private UsageMap globalUsageMap Tracks free pages in the database. | |
| INVALID_PAGE_BYTE_HEADER | back to summary |
|---|---|
| private static final byte[] INVALID_PAGE_BYTE_HEADER invalid page header, used when deallocating old pages. data pages generally have 4 interesting bytes at the beginning which we want to reset. | |
| INVALID_PAGE_NUMBER | back to summary |
|---|---|
| pack-priv static final int INVALID_PAGE_NUMBER | |
| invalidPageBytes | back to summary |
|---|---|
| private final ByteBuffer invalidPageBytes buffer used when deallocating old pages. data pages generally have 4 interesting bytes at the beginning which we want to reset. | |
| knownFileSize | back to summary |
|---|---|
| private long knownFileSize Cached size of the channel, in bytes. The file only ever grows, and only via | |
| PAGE_GLOBAL_USAGE_MAP | back to summary |
|---|---|
| pack-priv static final int PAGE_GLOBAL_USAGE_MAP Global usage map always lives on page 1 | |
| ROW_GLOBAL_USAGE_MAP | back to summary |
|---|---|
| pack-priv static final int ROW_GLOBAL_USAGE_MAP Global usage map always lives at row 0 | |
| tempDecodeBufferH | back to summary |
|---|---|
| private TempBufferHolder tempDecodeBufferH | |
| writeCount | back to summary |
|---|---|
| private int writeCount | |
| PageChannel | back to summary |
|---|---|
| protected PageChannel(boolean testing) Only used by unit tests | |
| PageChannel | back to summary |
|---|---|
public PageChannel(FileChannel channel, boolean closeChannel, JetFormat format, boolean autoSync)
| |
| allocateNewPage | back to summary |
|---|---|
| public int allocateNewPage() throws IOException Allocates a new page in the database. Data in the page is undefined until it is written in a call to | |
| applyHeaderMask | back to summary |
|---|---|
| private void applyHeaderMask(ByteBuffer buffer) Applies the XOR mask to the database header in the given buffer. | |
| assertWriting | back to summary |
|---|---|
| private void assertWriting() Asserts that a write operation is in progress. | |
| close | back to summary |
|---|---|
| public void close() throws IOException Implements java. Doc from java. Closes this channel. After a channel is closed, any further attempt to invoke I/O
operations upon it will cause a If this channel is already closed then invoking this method has no effect. This method may be invoked at any time. If some other thread has already invoked it, however, then another invocation will block until the first invocation is complete, after which it will return without effect.
| |
| createBuffer | back to summary |
|---|---|
| public static ByteBuffer createBuffer(int size) Returns a newly-allocated buffer of the given size and DEFAULT_BYTE_ORDER byte order.
| |
| createBuffer | back to summary |
|---|---|
| public static ByteBuffer createBuffer(int size, ByteOrder order) Returns a newly-allocated buffer of the given size and byte order.
| |
| createPageBuffer | back to summary |
|---|---|
| public ByteBuffer createPageBuffer() Returns a newly-allocated buffer that can be passed to readPage.
| |
| deallocatePage | back to summary |
|---|---|
| public void deallocatePage(int pageNumber) throws IOException Deallocate a previously used page in the database. | |
| finishWrite | back to summary |
|---|---|
| public void finishWrite() throws IOException Completes a "logical" write operation. This method should be called in finally block which wraps a logical write operation (which is preceded by a | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements java. Doc from java. Flushes this stream by writing any buffered output to the underlying stream.
| |
| getFileSize | back to summary |
|---|---|
private long getFileSize() throws IOException
| |
| getFormat | back to summary |
|---|---|
| public JetFormat getFormat() | |
| getNextPageNumber | back to summary |
|---|---|
| private int getNextPageNumber(long size) Returns the next page number based on the given file size. | |
| getPageOffset | back to summary |
|---|---|
| private long getPageOffset(int pageNumber) Returns the offset for a page within the file. | |
| initialize | back to summary |
|---|---|
| public void initialize(DatabaseImpl database, CodecProvider codecProvider) throws IOException Does second-stage initialization, must be called after construction. | |
| isAutoSync | back to summary |
|---|---|
| public boolean isAutoSync() | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements java. Doc from java. Tells whether or not this channel is open.
| |
| isWriting | back to summary |
|---|---|
| public boolean isWriting() Returns | |
| narrowBuffer | back to summary |
|---|---|
| public static ByteBuffer narrowBuffer(ByteBuffer buffer, int position, int limit) Returns a duplicate of the current buffer narrowed to the given position and limit. mark will be set at the current position.
| |
| readPage | back to summary |
|---|---|
| public void readPage(ByteBuffer buffer, int pageNumber) throws IOException Reads the given page into the buffer, decoding it if necessary.
| |
| readRootPage | back to summary |
|---|---|
| public void readRootPage(ByteBuffer buffer) throws IOException Reads the root page into the buffer; this works before the channel is fully initialized.
| |
| startExclusiveWrite | back to summary |
|---|---|
| public void startExclusiveWrite() Begins an exclusive "logical" write operation (throws an exception if another write operation is outstanding). See | |
| startWrite | back to summary |
|---|---|
| public void startWrite() Begins a "logical" write operation. See | |
| validatePageNumber | back to summary |
|---|---|
| private void validatePageNumber(int pageNumber) throws IOException Validates that the given pageNumber is valid for this database. | |
| wrap | back to summary |
|---|---|
| public static ByteBuffer wrap(byte[] bytes) Returns a ByteBuffer wrapping the given bytes and configured with the default byte order. | |
| writePage | back to summary |
|---|---|
| public void writePage(ByteBuffer page, int pageNumber) throws IOException Write a page to disk
| |
| writePage | back to summary |
|---|---|
| public void writePage(ByteBuffer page, int pageNumber, int pageOffset) throws IOException Write a page (or part of a page) to disk
| |