PageOutputStream

An output stream that writes into a page store.

Methods
PageOutputStream(PageStore store, int trunkPage, BitField exclude, int logKey, boolean atEnd)
Create a new page output stream.
PageOutputStream(PageStore store, int trunkPage, BitField exclude, int logKey, boolean atEnd)
Create a new page output stream.
Parameters:
store - the page store
trunkPage - the first trunk page (already allocated)
exclude - the pages not to use
logKey - the log key of the first trunk page
atEnd - whether only pages at the end of the file should be used
void close()
Close the stream.
void close()
Close the stream.
void fillPage()
Fill the data page with zeros and write it.
void fillPage()
Fill the data page with zeros and write it. This is required for a checkpoint.
void flush()
Write all data.
void flush()
Write all data.
void free(PageStreamTrunk t)
Remove a trunk page from the stream.
void free(PageStreamTrunk t)
Remove a trunk page from the stream.
Parameters:
t - the trunk page
void freeReserved()
Free up all reserved pages.
void freeReserved()
Free up all reserved pages.
int getCurrentDataPageId()
int getCurrentDataPageId()
int getMinPageId()
Get the smallest possible page id used.
int getMinPageId()
Get the smallest possible page id used. This is the trunk page if only appending at the end of the file, or 0.
Returns:
the smallest possible page.
long getSize()
long getSize()
void reserve(int minBuffer)
Allocate the required pages so that no pages need to be allocated while writing.
void reserve(int minBuffer)
Allocate the required pages so that no pages need to be allocated while writing.
Parameters:
minBuffer - the number of bytes to allocate
void write(byte[] b, int off, int len)
Write the data.
void write(byte[] b, int off, int len)
Write the data.
Parameters:
b - the buffer
off - the offset
len - the length