|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.lmu.ifi.dbs.elki.persistent.AbstractPageFile<P>
de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile<P>
de.lmu.ifi.dbs.elki.persistent.OnDiskArrayPageFile<P>
P - Page typepublic class OnDiskArrayPageFile<P extends Page>

A OnDiskArrayPageFile stores objects persistently that implement the
Page interface. For convenience each page is represented by a
single file. All pages are stored in a specified directory.
| Field Summary | |
|---|---|
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. |
| Fields inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile |
|---|
emptyPages, nextPageID, pageSize |
| Fields inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile |
|---|
readAccess, writeAccess |
| Constructor Summary | |
|---|---|
OnDiskArrayPageFile(int pageSize,
String fileName)
Creates a new OnDiskArrayPageFile from an existing file. |
|
| Method Summary | |
|---|---|
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(Integer pageID,
P page)
Write page to disk. |
| Methods inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractStoringPageFile |
|---|
getInnerStatistics, getNextPageID, getPageSize, setNextPageID, setPageID |
| Methods inherited from class de.lmu.ifi.dbs.elki.persistent.AbstractPageFile |
|---|
getReadOperations, getWriteOperations, resetPageAccess, writePage |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public OnDiskArrayPageFile(int pageSize,
String fileName)
pageSize - page sizefileName - the name of the file| Method Detail |
|---|
public P readPage(int pageID)
pageID - the id of the page to be returned
public 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 deleted
public void writePage(Integer pageID,
P page)
writePage in class AbstractPageFile<P extends Page>pageID - page idpage - the page which has to be written to diskpublic void close()
close in interface PageFile<P extends Page>close in class AbstractPageFile<P extends Page>public void clear()
private P byteBufferToPage(ByteBuffer buffer)
buffer - the buffer from which the object should be reconstructed
private byte[] pageToByteArray(P page)
page - the object to be serialized
public boolean initialize(PageHeader header)
AbstractStoringPageFile
initialize in interface PageFile<P extends Page>initialize in class AbstractStoringPageFile<P extends Page>header - Header
|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||