|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.persistent.DefaultPageHeader
public class DefaultPageHeader
Default implementation of a page header.
Field Summary | |
---|---|
private static int |
FILE_VERSION
Version number of this header (magic number). |
private int |
pageSize
The size of a page in bytes. |
private static int |
SIZE
The size of this header in Bytes, which is 8 Bytes ( 4 Bytes for FILE_VERSION and 4 Bytes for pageSize ). |
Constructor Summary | |
---|---|
DefaultPageHeader()
Empty constructor for serialization. |
|
DefaultPageHeader(int pageSize)
Creates a new header with the specified parameters. |
Method Summary | |
---|---|
byte[] |
asByteArray()
Return the header as byte array |
int |
getPageSize()
Returns the size of a page in Bytes. |
int |
getReservedPages()
Returns the number of pages necessary for the header |
void |
readHeader(byte[] data)
Initializes this header from the given Byte array. |
void |
readHeader(RandomAccessFile file)
Initializes this header from the specified file. |
int |
size()
Returns the value of SIZE ). |
void |
writeHeader(RandomAccessFile file)
Writes this header to the specified file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int SIZE
FILE_VERSION
and 4 Bytes for pageSize
).
private static final int FILE_VERSION
private int pageSize
Constructor Detail |
---|
public DefaultPageHeader()
public DefaultPageHeader(int pageSize)
pageSize
- the size of a page in bytesMethod Detail |
---|
public int size()
SIZE
).
size
in interface PageHeader
public void readHeader(RandomAccessFile file) throws IOException
pageSize
from the file.
readHeader
in interface PageHeader
file
- the file to which this header belongs
IOException
- if an I/O-error occurs during readingpublic void readHeader(byte[] data)
pageSize
from the file.
readHeader
in interface PageHeader
data
- byte array with the page data.public void writeHeader(RandomAccessFile file) throws IOException
version
of this header and the integer value of pageSize
to the
file.
writeHeader
in interface PageHeader
file
- the file to which this header belongs
IOException
- IOException if an I/O-error occurs during writingpublic byte[] asByteArray()
PageHeader
asByteArray
in interface PageHeader
public int getPageSize()
getPageSize
in interface PageHeader
public int getReservedPages()
getReservedPages
in interface PageHeader
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |