public interface ISqlJetFileSystem
ISqlJetFileSystem
object defines the interface between
the SqlJet core and the underlying file system.
The randomness(), sleep(), and currentTime() interfaces
are not strictly a part of the filesystem, but they are
included in the ISqlJetFileSystem
structure for completeness.Modifier and Type | Method and Description |
---|---|
boolean |
access(java.io.File path,
SqlJetFileAccesPermission permission)
The flags argument to access() may be
SqlJetFileAccesPermission.EXISTS
to test for the existence of a file, or SqlJetFileAccesPermission.READWRITE to
test whether a file is readable and writable, or SqlJetFileAccesPermission#READ
to test whether a file is at least readable. |
long |
currentTime()
The currentTime() method returns a Julian Day Number for the current date and time.
|
boolean |
delete(java.io.File path,
boolean sync)
Delete the file.
|
java.lang.String |
getFullPath(java.io.File filename) |
java.lang.String |
getName()
The getName() returns the name of the FS module.
|
java.io.File |
getTempFile() |
ISqlJetFile |
memJournalOpen()
Open a memory journal file.
|
ISqlJetFile |
open(java.io.File path,
SqlJetFileType type,
java.util.Set<SqlJetFileOpenPermission> permissions)
The flags argument to open() includes all set in
the flags argument to ISqlJet.open().
|
byte[] |
randomness(int numBytes)
The randomness() function returns numBytes bytes of good-quality randomness.
|
long |
sleep(long microseconds)
The sleep() method causes the calling thread to sleep for at
least the number of microseconds given.
|
java.lang.String getName()
ISqlJetFile open(java.io.File path, SqlJetFileType type, java.util.Set<SqlJetFileOpenPermission> permissions) throws SqlJetException
SqlJetFileOpenPermission.READWRITE
and
SqlJetFileOpenPermission.CREATE
.
If open() opens a file read-only then it sets flags in
ISqlJetFile.getPermissions()
to
include SqlJetFileOpenPermission.READONLY
.
Other permissions may be set.
SqlJet will also add one of the following flags to the open()
call, depending on the object being opened:
SqlJetFileOpenPermission#MAIN_DB
SqlJetFileOpenPermission#MAIN_JOURNAL
SqlJetFileOpenPermission#TEMP_DB
SqlJetFileOpenPermission#TEMP_JOURNAL
SqlJetFileOpenPermission#TRANSIENT_DB
SqlJetFileOpenPermission#SUBJOURNAL
SqlJetFileOpenPermission#MASTER_JOURNAL
SqlJetIOException
. Or the implementation might recognize that a database
file will be doing page-aligned sector reads and writes in a random
order and set up its I/O subsystem accordingly.
SqlJet might also add one of the following flags to the open() method:
The SqlJetFileOpenPermission.DELETEONCLOSE
flag means the file should be
deleted when it is closed. The SqlJetFileOpenPermission.DELETEONCLOSE
will be set for TEMP databases, journals and for subjournals.
The SqlJetFileOpenPermission.EXCLUSIVE
flag means the file should be opened
for exclusive access. This flag is set for all files except
for the main database file.path
- File
or NULL. If NULL then open()
must invite its own temporary name for the file. Whenever the
filename parameter is NULL it will also be the case that the
flags parameter will include SqlJetFileOpenPermission.DELETEONCLOSE
.permissions
- Exactly one of the SqlJetFileOpenPermission.READWRITE
and
SqlJetFileOpenPermission.READONLY
flags must be set, and
if SqlJetFileOpenPermission.CREATE
is set,
then SqlJetFileOpenPermission.READWRITE
must also be set, and
if SqlJetFileOpenPermission.EXCLUSIVE
is set,
then SqlJetFileOpenPermission.CREATE
must also be set.
if SqlJetFileOpenPermission.DELETEONCLOSE
is set,
then SqlJetFileOpenPermission.CREATE
must also be set.SqlJetException
- If it is impossible to open file.ISqlJetFile memJournalOpen()
boolean delete(java.io.File path, boolean sync) throws SqlJetException
path
- sync
- SqlJetException
boolean access(java.io.File path, SqlJetFileAccesPermission permission) throws SqlJetException
SqlJetFileAccesPermission.EXISTS
to test for the existence of a file, or SqlJetFileAccesPermission.READWRITE
to
test whether a file is readable and writable, or SqlJetFileAccesPermission#READ
to test whether a file is at least readable. The file can be a directory.
Test the existance of or access permissions of file. The
test performed depends on the value of flags:
SqlJetFileAccesPermission.EXISTS
: Return true if the file exists
SqlJetFileAccesPermission.READWRITE
: Return true if the file is read and writable.
SqlJetFileAccesPermission#READ
: Return true if the file is readable.
Otherwise return false.path
- permission
- SqlJetException
byte[] randomness(int numBytes)
numBytes
- long sleep(long microseconds)
microseconds
- long currentTime()
java.io.File getTempFile() throws java.io.IOException
java.io.IOException
java.lang.String getFullPath(java.io.File filename) throws SqlJetException
SqlJetException
Copyright © 2009-2010 TMate Software Ltd. All Rights Reserved.