
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_PAGEIndicates an empty page. | 
| private boolean | existedWhether or not the file originally existed | 
| private OnDiskArray | fileThe file storing the pages. | 
| private File | filenameThe file name to use | 
| private static int | FILLED_PAGEIndicates a filled page. | 
| protected PageHeader | headerThe header of this page file. | 
emptyPages, nextPageID, pageSizereadAccess, writeAccess| 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. | 
| 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. | 
getInnerStatistics, getNextPageID, getPageSize, setNextPageID, setPageIDgetReadOperations, getWriteOperations, resetPageAccess, writePageprivate 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 - Header