| org.apache.derby.io.StorageRandomAccessFile
All known Subclasses: org.apache.derbyTesting.functionTests.util.corruptio.CorruptRandomAccessFile, org.apache.derby.impl.io.DirRandomAccessFile,
StorageRandomAccessFile | public interface StorageRandomAccessFile extends DataInput,DataOutput(Code) | | This interface abstracts an object that implements reading and writing on a random access
file. It extends DataInput and DataOutput, so it implicitly contains all the methods of those
interfaces. Any method in this interface that also appears in the java.io.RandomAccessFile class
should behave as the java.io.RandomAccessFile method does.
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.
See Also: java.io.RandomAccessFile |
Method Summary | |
public void | close() Closes this file. | public long | getFilePointer() Get the current offset in this file.
the current file pointer. | public long | length() Gets the length of this file.
the number of bytes this file. | public void | seek(long newFilePointer) Set the file pointer. | public void | setLength(long newLength) Sets the length of this file, either extending or truncating it. | public void | sync(boolean metaData) Force any changes out to the persistent store. |
getFilePointer | public long getFilePointer() throws IOException(Code) | | Get the current offset in this file.
the current file pointer. exception: IOException - - if an I/O error occurs. |
length | public long length() throws IOException(Code) | | Gets the length of this file.
the number of bytes this file. exception: IOException - - if an I/O error occurs. |
seek | public void seek(long newFilePointer) throws IOException(Code) | | 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..
Parameters: newFilePointer - the new file pointer, measured in bytes from the beginning of the file. exception: IOException - - if newFilePointer is less than 0 or an I/O error occurs. |
setLength | public void setLength(long newLength) throws IOException(Code) | | 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.
Parameters: newLength - The new file length. exception: IOException - If an I/O error occurs. |
sync | public void sync(boolean metaData) throws IOException(Code) | | 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.
Parameters: metaData - If true then this method must force both changes to the file'scontents and metadata to be written to storage; if false, it need only force file content changesto be written. The implementation is allowed to ignore this parameter and always force outmetadata changes. exception: SyncFailedException - if a possibly recoverable error occurs. exception: IOException - If an IO error occurs. |
|
|