de.lmu.ifi.dbs.elki.persistent
Interface PageHeader

All Known Implementing Classes:
DefaultPageHeader, MkTreeHeader, TreeIndexHeader

public interface PageHeader

Defines the requirements for a header of a persistent page file. A header must at least store the size of a page in Bytes.


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 specified file.
 void readHeader(RandomAccessFile file)
          Initializes this header from the specified file.
 int size()
          Returns the size of this header in Bytes.
 void writeHeader(RandomAccessFile file)
          Writes this header to the specified file.
 

Method Detail

size

int size()
Returns the size of this header in Bytes.

Returns:
the size of this header in Bytes

readHeader

void readHeader(RandomAccessFile file)
                throws IOException
Initializes this header from the specified file.

Parameters:
file - the file to which this header belongs
Throws:
IOException - if an I/O-error occurs during reading

readHeader

void readHeader(byte[] data)
Initializes this header from the specified file.

Parameters:
data - byte array with the page data.

writeHeader

void writeHeader(RandomAccessFile file)
                 throws IOException
Writes this header to the specified file.

Parameters:
file - the file to which this header belongs
Throws:
IOException - IOException if an I/O-error occurs during writing

asByteArray

byte[] asByteArray()
Return the header as byte array

Returns:
header as byte array

getPageSize

int getPageSize()
Returns the size of a page in Bytes.

Returns:
the size of a page in Bytes

getReservedPages

int getReservedPages()
Returns the number of pages necessary for the header

Returns:
the number of pages

Release 0.4.0 (2011-09-20_1324)