|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.persistent.PageFile<P>
de.lmu.ifi.dbs.elki.persistent.PersistentPageFile<P>
P
- Page typepublic class PersistentPageFile<P extends Page<P>>
A PersistentPageFile 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 RandomAccessFile |
file
The file storing the pages. |
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.PageFile |
---|
cache, emptyPages, nextPageID, pageSize, readAccess, writeAccess |
Constructor Summary | |
---|---|
PersistentPageFile(PageHeader header,
int cacheSize,
Cache<P> cache,
String fileName)
Creates a new PersistentPageFile from an existing file. |
Method Summary | |
---|---|
private P |
byteArrayToPage(byte[] array)
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. |
void |
objectRemoved(P page)
This method is called by the cache if the page is not longer
stored in the cache and has to be written to disk. |
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. |
Methods inherited from class de.lmu.ifi.dbs.elki.persistent.PageFile |
---|
getLogicalPageAccess, getNextPageID, getPhysicalReadAccess, getPhysicalWriteAccess, initCache, resetPageAccess, setCacheSize, setNextPageID, setPageID, 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 final RandomAccessFile file
protected final PageHeader header
Constructor Detail |
---|
public PersistentPageFile(PageHeader header, int cacheSize, Cache<P> cache, String fileName)
header
- the header of this filefileName
- the name of the filecacheSize
- the size of the cache in Bytecache
- the class of the cache to be usedMethod Detail |
---|
public P readPage(int pageID)
readPage
in class PageFile<P extends Page<P>>
pageID
- the id of the page to be returned
public void deletePage(int pageID)
deletePage
in class PageFile<P extends Page<P>>
pageID
- the id of the node to be deletedpublic void objectRemoved(P page)
page
is not longer
stored in the cache and has to be written to disk.
page
- the page which has to be written to diskpublic void close()
close
in class PageFile<P extends Page<P>>
public void clear()
clear
in class PageFile<P extends Page<P>>
private P byteArrayToPage(byte[] array)
array
- the byte array from which the object should be reconstructed
private byte[] pageToByteArray(P page)
page
- the object to be serialized
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |