java.lang.Object
java.io.RandomAccessFile
org.hsqldb.DatabaseFile
- All Implemented Interfaces:
- java.io.DataInput, java.io.DataOutput
- Direct Known Subclasses:
- ReverseDatabaseFile
- class DatabaseFile
- extends java.io.RandomAccessFile
This class provides methods for reading and writing data from a
database file such as that used for storing a cached table.
- Version:
- 1.7.0
|
Field Summary |
protected int |
count
|
protected byte[] |
in
|
protected int |
index
|
protected long |
pos
|
|
Method Summary |
void |
close()
This method closes the file and frees up all file related system
resources. |
int |
read()
This method reads a single byte of data from the file and returns it
as an integer. |
int |
read(byte[] b)
This method reads bytes from the file into the specified array. |
int |
readInteger()
|
void |
readSeek(long newPos)
|
protected void |
realSeek(long newPos)
|
void |
seek(long newPos)
This method sets the current file position to the specified offset
from the beginning of the file. |
void |
write(byte[] b)
This method writes all the bytes in the specified array to the file. |
void |
writeInteger(int i)
|
| Methods inherited from class java.io.RandomAccessFile |
getChannel, getFD, getFilePointer, length, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
in
protected byte[] in
pos
protected long pos
index
protected int index
count
protected int count
DatabaseFile
DatabaseFile(java.lang.String name,
java.lang.String mode,
int inSize)
throws java.io.FileNotFoundException,
java.io.IOException
realSeek
protected void realSeek(long newPos)
throws java.io.IOException
seek
public void seek(long newPos)
throws java.io.IOException
- Description copied from class:
java.io.RandomAccessFile
- This method sets the current file position to the specified offset
from the beginning of the file. Note that some operating systems will
allow the file pointer to be set past the current end of the file.
readSeek
public void readSeek(long newPos)
throws java.io.IOException
read
public int read()
throws java.io.IOException
- Description copied from class:
java.io.RandomAccessFile
- This method reads a single byte of data from the file and returns it
as an integer.
read
public int read(byte[] b)
throws java.io.IOException
- Description copied from class:
java.io.RandomAccessFile
- This method reads bytes from the file into the specified array. The
bytes are stored starting at the beginning of the array and up to
buf.length bytes can be read.
readInteger
public int readInteger()
throws java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Description copied from class:
java.io.RandomAccessFile
- This method writes all the bytes in the specified array to the file.
The file must be open read-write in order for this operation to succeed.
writeInteger
public void writeInteger(int i)
throws java.io.IOException
close
public void close()
throws java.io.IOException
- Description copied from class:
java.io.RandomAccessFile
- This method closes the file and frees up all file related system
resources. Since most operating systems put a limit on how many files
may be opened at any given time, it is a good idea to close all files
when no longer needed to avoid hitting this limit