
P - Page typepublic class OnDiskArrayPageFile<P extends Page> extends AbstractStoringPageFile<P>
Page interface. For convenience each page is represented by a
 single file. All pages are stored in a specified directory.| Modifier and Type | Field and Description | 
|---|---|
private static int | 
EMPTY_PAGE
Indicates an empty page. 
 | 
private boolean | 
existed
Whether or not the file originally existed 
 | 
private OnDiskArray | 
file
The file storing the pages. 
 | 
private File | 
filename
The file name to use 
 | 
private static int | 
FILLED_PAGE
Indicates a filled page. 
 | 
protected PageHeader | 
header
The header of this page file. 
 | 
private static Logging | 
LOG
Class logger. 
 | 
emptyPages, nextPageID, pageSize| Constructor and Description | 
|---|
OnDiskArrayPageFile(int pageSize,
                   String fileName)
Creates a new OnDiskArrayPageFile from an existing file. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
private P | 
byteBufferToPage(ByteBuffer buffer)
Reconstruct a serialized object from the specified byte array. 
 | 
void | 
clear()
Clears this PageFile. 
 | 
void | 
close()
Closes this file. 
 | 
void | 
deletePage(int pageID)
Deletes the node with the specified id from this file. 
 | 
protected Logging | 
getLogger()
Get the class logger. 
 | 
boolean | 
initialize(PageHeader header)
Initialize the page file with the given header - return "true" if the file
 already existed. 
 | 
private byte[] | 
pageToByteArray(P page)
Serializes an object into a byte array. 
 | 
P | 
readPage(int pageID)
Reads the page with the given id from this file. 
 | 
void | 
writePage(int pageID,
         P page)
Write page to disk. 
 | 
getNextPageID, getPageSize, logStatistics, setNextPageID, setPageIDcountRead, countWrite, writePageprivate static final Logging LOG
private static final int EMPTY_PAGE
private static final int FILLED_PAGE
private File filename
private OnDiskArray file
protected PageHeader header
private final boolean existed
public OnDiskArrayPageFile(int pageSize,
                   String fileName)
pageSize - page sizefileName - the name of the filepublic P readPage(int pageID)
pageID - the id of the page to be returnedpublic void deletePage(int pageID)
deletePage in interface PageFile<P extends Page>deletePage in class AbstractStoringPageFile<P extends Page>pageID - the id of the node to be deletedpublic void writePage(int pageID,
             P page)
writePage in class AbstractPageFile<P extends Page>pageID - page idpage - the page which has to be written to diskpublic void close()
public void clear()
private P byteBufferToPage(ByteBuffer buffer)
buffer - the buffer from which the object should be reconstructedprivate byte[] pageToByteArray(P page)
page - the object to be serializedpublic boolean initialize(PageHeader header)
AbstractStoringPageFileinitialize in interface PageFile<P extends Page>initialize in class AbstractStoringPageFile<P extends Page>header - Headerprotected Logging getLogger()
AbstractPageFilegetLogger in class AbstractPageFile<P extends Page>