Interface ISqlJetFileSystem
- All Known Implementing Classes:
SqlJetFileSystem
public interface ISqlJetFileSystem
File System Interface.
An instance of the
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.- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
Method Summary
Modifier and TypeMethodDescriptionboolean
access
(File path, SqlJetFileAccesPermission permission) The flags argument to access() may beSqlJetFileAccesPermission.EXISTS
to test for the existence of a file, orSqlJetFileAccesPermission.READWRITE
to test whether a file is readable and writable, orinvalid reference
SqlJetFileAccesPermission#READ
long
The currentTime() method returns a Julian Day Number for the current date and time.boolean
Delete the file.getFullPath
(File filename) getName()
The getName() returns the name of the FS module.Open a memory journal file.open
(File path, SqlJetFileType type, 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.
-
Method Details
-
getName
String getName()The getName() returns the name of the FS module. The name must be unique across all FS modules.- Returns:
-
open
ISqlJetFile open(File path, SqlJetFileType type, Set<SqlJetFileOpenPermission> permissions) throws SqlJetException The flags argument to open() includes all set in the flags argument to ISqlJet.open(). Flags includes at leastSqlJetFileOpenPermission.READWRITE
andSqlJetFileOpenPermission.CREATE
. If open() opens a file read-only then it sets flags inISqlJetFile.getPermissions()
to includeSqlJetFileOpenPermission.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:-
invalid reference
SqlJetFileOpenPermission#MAIN_DB
-
invalid reference
SqlJetFileOpenPermission#MAIN_JOURNAL
-
invalid reference
SqlJetFileOpenPermission#TEMP_DB
-
invalid reference
SqlJetFileOpenPermission#TEMP_JOURNAL
-
invalid reference
SqlJetFileOpenPermission#TRANSIENT_DB
-
invalid reference
SqlJetFileOpenPermission#SUBJOURNAL
-
invalid reference
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: TheSqlJetFileOpenPermission.DELETEONCLOSE
flag means the file should be deleted when it is closed. TheSqlJetFileOpenPermission.DELETEONCLOSE
will be set for TEMP databases, journals and for subjournals. TheSqlJetFileOpenPermission.EXCLUSIVE
flag means the file should be opened for exclusive access. This flag is set for all files except for the main database file.- Parameters:
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 includeSqlJetFileOpenPermission.DELETEONCLOSE
.permissions
- Exactly one of theSqlJetFileOpenPermission.READWRITE
andSqlJetFileOpenPermission.READONLY
flags must be set, and ifSqlJetFileOpenPermission.CREATE
is set, thenSqlJetFileOpenPermission.READWRITE
must also be set, and ifSqlJetFileOpenPermission.EXCLUSIVE
is set, thenSqlJetFileOpenPermission.CREATE
must also be set. ifSqlJetFileOpenPermission.DELETEONCLOSE
is set, thenSqlJetFileOpenPermission.CREATE
must also be set.- Returns:
- Opened file.
- Throws:
SqlJetException
- If it is impossible to open file.
-
-
memJournalOpen
ISqlJetFile memJournalOpen()Open a memory journal file. -
delete
Delete the file. If the sync argument is true, sync() the directory after deleting the file.- Parameters:
path
-sync
-- Returns:
- Throws:
SqlJetException
-
access
The flags argument to access() may beSqlJetFileAccesPermission.EXISTS
to test for the existence of a file, orSqlJetFileAccesPermission.READWRITE
to test whether a file is readable and writable, orinvalid reference
SqlJetFileAccesPermission#READ
SqlJetFileAccesPermission.EXISTS
: Return true if the file existsSqlJetFileAccesPermission.READWRITE
: Return true if the file is read and writable.invalid reference
SqlJetFileAccesPermission#READ
- Parameters:
path
-permission
-- Returns:
- Throws:
SqlJetException
-
randomness
byte[] randomness(int numBytes) The randomness() function returns numBytes bytes of good-quality randomness.- Parameters:
numBytes
-- Returns:
-
sleep
long sleep(long microseconds) The sleep() method causes the calling thread to sleep for at least the number of microseconds given.- Parameters:
microseconds
-- Returns:
-
currentTime
long currentTime()The currentTime() method returns a Julian Day Number for the current date and time.- Returns:
-
getTempFile
- Throws:
IOException
-
getFullPath
- Throws:
SqlJetException
-