public class PageIOManager
extends java.lang.Object
Constructor and Description |
---|
PageIOManager()
Constructs a new page I/O manager.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
dumpNumber(Page page,
byte[] bytes)
Dumps the number of tuples of the page.
|
protected static void |
dumpTuples(Page page,
byte[] bytes)
Dump the page tuples to disk.
|
static int |
fetchNumber(byte[] bytes)
Fetches the number of tuples from a byte array.
|
protected static Page |
fetchTuples(Relation relation,
PageIdentifier pid,
byte[] bytes)
Reads in tuples from disk and puts them in a new page.
|
protected static void |
pad(byte[] bytes,
int start)
Pad a byte array with zeros to reach the disk page size.
|
static Page |
readPage(Relation relation,
PageIdentifier pid,
java.io.RandomAccessFile raf)
Reads a page from disk.
|
static void |
writePage(java.io.RandomAccessFile raf,
Page page)
Writes a page to an output file.
|
public static void writePage(java.io.RandomAccessFile raf, Page page) throws StorageManagerException
raf
- the output file.page
- the page to be written.StorageManagerException
- thrown whenever there is an
output error.public static Page readPage(Relation relation, PageIdentifier pid, java.io.RandomAccessFile raf) throws StorageManagerException
relation
- the relation the requested page conforms to.pid
- the page identifier of the page.raf
- the output file.StorageManagerException
- whenever the page cannot be
properly read.protected static void dumpNumber(Page page, byte[] bytes)
page
- the page to be written.bytes
- the output byte array.protected static void dumpTuples(Page page, byte[] bytes) throws StorageManagerException
page
- the page to be written to disk.bytes
- the output byte array for the tuples.StorageManagerException
- if theprotected static Page fetchTuples(Relation relation, PageIdentifier pid, byte[] bytes) throws StorageManagerException
relation
- the relation the page conforms to.pid
- the page identifier of the new page.bytes
- the byte array where the tuples are in.StorageManagerException
public static int fetchNumber(byte[] bytes)
bytes
- the byte array.protected static void pad(byte[] bytes, int start)
bytes
- the input byte array to be padded.start
- the starting offset in the byte array.