org.xerial.db.storage
Class DiskFile

java.lang.Object
  extended by org.xerial.db.storage.DiskFile
All Implemented Interfaces:
DBFile

public class DiskFile
extends Object
implements DBFile

The DiskFile wraps read/write accesses to files

Author:
leo

Constructor Summary
DiskFile(String filePath)
           
DiskFile(String filePath, String mode)
           
 
Method Summary
 void close()
          Closes the file.
 void read(byte[] buffer, int offset, int byteSize)
          Reads data from the file, and writes the read data to the specified buffer
 void seek(long filePos)
          Sets the file pointer offset, measured from the beginning of the file, at which the next read/write request occurs.
 void write(byte[] buffer, int offset, int byteSize)
          Writes the given data into the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskFile

public DiskFile(String filePath)
         throws FileNotFoundException
Throws:
FileNotFoundException

DiskFile

public DiskFile(String filePath,
                String mode)
         throws FileNotFoundException
Throws:
FileNotFoundException
Method Detail

read

public void read(byte[] buffer,
                 int offset,
                 int byteSize)
          throws DBException
Description copied from interface: DBFile
Reads data from the file, and writes the read data to the specified buffer

Specified by:
read in interface DBFile
Parameters:
buffer - the buffer into which the data is read
offset - the start offset in the buffer at which the data is written
byteSize - the bytes to read
Throws:
DBException

seek

public void seek(long filePos)
          throws DBException
Description copied from interface: DBFile
Sets the file pointer offset, measured from the beginning of the file, at which the next read/write request occurs. The fileBytePos can exceed the end of the file. Setting the fileBytePos higher than the end of the file does not expand the file size. The size will change by writing after the offset has been set beyond the end of the file.

Specified by:
seek in interface DBFile
Throws:
DBException

write

public void write(byte[] buffer,
                  int offset,
                  int byteSize)
           throws DBException
Description copied from interface: DBFile
Writes the given data into the file

Specified by:
write in interface DBFile
Parameters:
buffer - the data
offset - the start offset in the data
byteSize - the bytes to write
Throws:
DBException

close

public void close()
           throws DBException
Description copied from interface: DBFile
Closes the file.

Specified by:
close in interface DBFile
Throws:
DBException


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.