Each StorageRandomAccessFile has an associated file pointer, a byte offset in the file. All reading and writing takes place at the file pointer offset and advances it.
An implementation of StorageRandomAccessFile need not be thread safe. The database engine single-threads access to each StorageRandomAccessFile instance. Two threads will not access the same StorageRandomAccessFile instance at the same time.
| Modifier and Type | Method and Description |
|---|---|
| public StorageRandomAccessFile | |
| public void | |
| public long | |
| public long | |
| public int | Returns: the total number of bytes read into the buffer, or-1 if there is no more data because the end of
the file has been reached.the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes read. len)Reads up to |
| public void | seek(long
the new file pointer, measured in bytes from the beginning of the file. newFilePointer)Set the file pointer. |
| public void | setLength(long
The new file length. newLength)Sets the length of this file, either extending or truncating it. |
| public void |
| clone | back to summary |
|---|---|
| public StorageRandomAccessFile clone() Clone this file abstraction | |
| close | back to summary |
|---|---|
| public void close() throws IOException Closes this file.
| |
| getFilePointer | back to summary |
|---|---|
| public long getFilePointer() throws IOException Get the current offset in this file.
| |
| length | back to summary |
|---|---|
| public long length() throws IOException Gets the length of this file.
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Reads up to
| |
| seek | back to summary |
|---|---|
| public void seek(long newFilePointer) throws IOException Set the file pointer. It may be moved beyond the end of the file, but this does not change the length of the file. The length of the file is not changed until data is actually written..
| |
| setLength | back to summary |
|---|---|
| public void setLength(long newLength) throws IOException Sets the length of this file, either extending or truncating it. If the file is extended then the contents of the extension are not defined. If the file is truncated and the file pointer is greater than the new length then the file pointer is set to the new length.
| |
| sync | back to summary |
|---|---|
| public void sync() throws IOException Force any changes out to the persistent store. If the database is to be transient, that is, if the database does not survive a restart, then the sync method implementation need not do anything.
| |