Package elki.persistent
Interface PageHeader
-
- All Known Implementing Classes:
DefaultPageHeader,MkTreeHeader,RdKNNTreeHeader,TreeIndexHeader
public interface PageHeaderDefines 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 intgetPageSize()Returns the size of a page in Bytes.intgetReservedPages()Returns the number of pages necessary for the headervoidreadHeader(java.nio.ByteBuffer data)Initializes this header from the specified file.default voidreadHeader(java.nio.channels.FileChannel file)Read the header from an input file.intsize()Returns the size of this header in Bytes.voidwriteHeader(java.nio.ByteBuffer buffer)Writes this header to the specified file.default voidwriteHeader(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.IOExceptionRead 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.IOExceptionRead 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.IOExceptionWrites 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
-
-