Package elki.persistent
Interface PageHeader
-
- All Known Implementing Classes:
DefaultPageHeader
,MkTreeHeader
,RdKNNTreeHeader
,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.- Since:
- 0.1
- Author:
- Elke Achtert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
getPageSize()
Returns the size of a page in Bytes.int
getReservedPages()
Returns the number of pages necessary for the headervoid
readHeader(java.nio.ByteBuffer data)
Initializes this header from the specified file.default void
readHeader(java.nio.channels.FileChannel file)
Read the header from an input file.int
size()
Returns the size of this header in Bytes.void
writeHeader(java.nio.ByteBuffer buffer)
Writes this header to the specified file.default void
writeHeader(java.nio.channels.FileChannel file)
Read the header from an input file.
-
-
-
Method Detail
-
size
int size()
Returns the size of this header in Bytes.- Returns:
- the size of this header in Bytes
-
readHeader
default void readHeader(java.nio.channels.FileChannel file) throws java.io.IOException
Read the header from an input file.- Parameters:
file
- File to read from- Throws:
java.io.IOException
-
readHeader
void readHeader(java.nio.ByteBuffer data)
Initializes this header from the specified file.- Parameters:
data
- byte array with the page data.
-
writeHeader
default void writeHeader(java.nio.channels.FileChannel file) throws java.io.IOException
Read the header from an input file.- Parameters:
file
- File to read from- Throws:
java.io.IOException
-
writeHeader
void writeHeader(java.nio.ByteBuffer buffer) throws java.io.IOException
Writes this header to the specified file.- Parameters:
buffer
- Buffer to write to- Throws:
java.io.IOException
- IOException if an I/O-error occurs during writing
-
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
-
-