
public class DefaultPageHeader extends Object implements PageHeader
| Modifier and Type | Field and Description | 
|---|---|
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 and Description | 
|---|
DefaultPageHeader()
Empty constructor for serialization. 
 | 
DefaultPageHeader(int pageSize)
Creates a new header with the specified parameters. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
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. 
 | 
private static final int SIZE
FILE_VERSION and 4 Bytes for pageSize).private static final int FILE_VERSION
private int pageSize
public DefaultPageHeader()
public DefaultPageHeader(int pageSize)
pageSize - the size of a page in bytespublic int size()
SIZE).size in interface PageHeaderpublic void readHeader(RandomAccessFile file) throws IOException
pageSize from the file.readHeader in interface PageHeaderfile - the file to which this header belongsIOException - if an I/O-error occurs during readingpublic void readHeader(byte[] data)
pageSize from the file.readHeader in interface PageHeaderdata - 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 PageHeaderfile - the file to which this header belongsIOException - IOException if an I/O-error occurs during writingpublic byte[] asByteArray()
PageHeaderasByteArray in interface PageHeaderpublic int getPageSize()
getPageSize in interface PageHeaderpublic int getReservedPages()
getReservedPages in interface PageHeader