When used by the database engine all files will be under either the database
directory, specified by the databaseName argument of the StorageFactory. method, or under the temporary file
directory returned by the StorageFactory. method. All relative path names are relative to
the database directory.
The database engine will call this interface's methods from its own privilege blocks.
Different threads may operate on the same underlying file at the same time, either through the same or different StorageFile objects. The StiFile implementation must be capable of handling this.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the file exists and is writable, false if not.Determine whether the named file is writable. |
| public boolean | Returns: true if this thread's invocation of createNewFile successfully created the named file; false if not, i.e. false if the named file already exists or if another concurrent thread created it.If the named file does not already exist then create it as an empty normal file. |
| public boolean | Returns: true if the named file or directory is successfully deleted, false if notDeletes the named file or empty directory. |
| public boolean | Returns: true if the named file or directory is successfully deleted, false if notDeletes the named file and, if it is a directory, all the files and directories it contains. |
| public boolean | |
| public String | Returns: The pathname as a string.Converts this StorageFile into a canonical pathname string. |
| public int | Returns: EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE if the lock cannot be acquired because it is already held.EXCLUSIVE_FILE_LOCK if the lock was successfully acquired. NO_FILE_LOCK_SUPPORT if the system does not support exclusive locks. Get an exclusive lock with this name. |
| public InputStream | Returns: an input stream suitable for reading from the file.Creates an input stream from a file name. |
| public String | |
| public OutputStream | Returns: an output stream suitable for writing to the file.Creates an output stream from a file name. |
| public OutputStream | Returns: an output stream suitable for writing to the file.If true then data will be appended to the end of the file, if it already exists.
If false and a normal file already exists with this name the file will first be truncated
to zero length. append)Creates an output stream from a file name. |
| public StorageFile | Returns: An StorageFile denoting the parent directory of this StorageFile, if it has a parent, null if it does not have a parent.Get the name of the parent directory if this name includes a parent. |
| public String | |
| public StorageRandomAccessFile | Returns: an object that can be used for random access to the file."r", "rw", "rws", or "rwd". The "rws" and "rwd" modes specify
that the data is to be written to persistent store, consistent with the
java.io.RandomAccessFile class ("synchronized" with the persistent
storage, in the file system meaning of the word "synchronized"). However
the implementation is not required to implement the "rws" or "rwd"
modes. If the "rws" andr "rwd" modes are supported then the supportsRws() method
of the StorageFactory returns true. If supportsRws() returns false then the
implementation may treat "rws" and "rwd" as "rw". It is up to
the user of this interface to call the StorageRandomAccessFile.sync
method if necessary. However, if the "rws" or "rwd" modes are supported and the
RandomAccessFile was opened in "rws" or "rwd" mode then the
implementation of StorageRandomAccessFile.sync need not do anything. mode)Get a random access file. |
| public boolean | Returns: true if named file exists and is a directory, false if not. The return value is undefined if the storage is read-only.Tests whether the named file is a directory, or not. |
| public void | |
| public String[] | Returns: An array of the names of the files and directories in this directory denoted by this abstract pathname. The returned array will have length 0 if this directory is empty. Returns null if this StorageFile is not a directory, or if an I/O error occurs. The return value is undefined if the database is read-only.Get the names of all files and sub-directories in the directory named by this path name. |
| public boolean | |
| public boolean | Returns: true if the directory was created, false if notCreates the named directory, and all nonexistent parent directories. |
| public void | releaseExclusiveFileLock()
Release the resource associated with an earlier acquired exclusive lock releaseExclusiveFileLock() may delete the file |
| public boolean | Returns: true if the rename succeeded, false if not.the new name. newName)Rename the file denoted by this name. |
| public boolean | Returns: true if the named file or directory was made read-only, or it already was read-only; false if not.Make the named file or directory read-only. |
| EXCLUSIVE_FILE_LOCK | back to summary |
|---|---|
| public static final int EXCLUSIVE_FILE_LOCK | |
| EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE | back to summary |
|---|---|
| public static final int EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE | |
| NO_FILE_LOCK_SUPPORT | back to summary |
|---|---|
| public static final int NO_FILE_LOCK_SUPPORT | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite() Determine whether the named file is writable.
| |
| createNewFile | back to summary |
|---|---|
| public boolean createNewFile() throws IOException If the named file does not already exist then create it as an empty normal file. The implementation must synchronize with other threads accessing the same file (in the same or a different process). If two threads both attempt to create a file with the same name at the same time then at most one should succeed.
| |
| delete | back to summary |
|---|---|
| public boolean delete() Deletes the named file or empty directory. This method does not delete non-empty directories.
| |
| deleteAll | back to summary |
|---|---|
| public boolean deleteAll() Deletes the named file and, if it is a directory, all the files and directories it contains.
| |
| exists | back to summary |
|---|---|
| public boolean exists() Tests whether the named file exists.
| |
| getCanonicalPath | back to summary |
|---|---|
| public String getCanonicalPath() throws IOException Converts this StorageFile into a canonical pathname string. The form of the canonical path is system dependent.
| |
| getExclusiveFileLock | back to summary |
|---|---|
| public int getExclusiveFileLock() throws StandardException Get an exclusive lock with this name. This is used to ensure that two or more JVMs do not open the same database at the same time. ny StorageFile that has getExclusiveFileLock() called on it is not intended to be read from or written to. It's sole purpose is to provide a locked entity to avoid multiple instances of Derby accessing the same database. getExclusiveFileLock() may delete or overwrite any existing file.
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() throws FileNotFoundException Creates an input stream from a file name.
| |
| getName | back to summary |
|---|---|
public String getName()
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream() throws FileNotFoundException Creates an output stream from a file name. If a normal file already exists with this name it will first be truncated to zero length.
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream(boolean append) throws FileNotFoundException Creates an output stream from a file name.
| |
| getParentDir | back to summary |
|---|---|
| public StorageFile getParentDir() Get the name of the parent directory if this name includes a parent.
| |
| getPath | back to summary |
|---|---|
| public String getPath() Converts this StorageFile into a pathname string. The character returned by StorageFactory.getSeparator() is used to separate the directory and file names in the sequence. The returned path may include the database directory. Therefore it cannot be directly used to make an StorageFile equivalent to this one.
| |
| getRandomAccessFile | back to summary |
|---|---|
| public StorageRandomAccessFile getRandomAccessFile(String mode) throws FileNotFoundException Get a random access file. This method is not called if the StorageFactory is read only. It is unspecified if the StorageFactory that created it is not a WritableStorageFactory.
| |
| isDirectory | back to summary |
|---|---|
| public boolean isDirectory() Tests whether the named file is a directory, or not. This is only called in writable storage factories.
| |
| limitAccessToOwner | back to summary |
|---|---|
| public void limitAccessToOwner() throws IOException Use when creating a new file. By default, a file created in an
underlying file system, if applicable, will have read and write access
for the file owner unless the property | |
| list | back to summary |
|---|---|
| public String[] list() Get the names of all files and sub-directories in the directory named by this path name. This method is only used in a writable database.
| |
| mkdir | back to summary |
|---|---|
| public boolean mkdir() Creates the named directory.
| |
| mkdirs | back to summary |
|---|---|
| public boolean mkdirs() Creates the named directory, and all nonexistent parent directories.
| |
| releaseExclusiveFileLock | back to summary |
|---|---|
| public void releaseExclusiveFileLock() Release the resource associated with an earlier acquired exclusive lock releaseExclusiveFileLock() may delete the file
| |
| renameTo | back to summary |
|---|---|
| public boolean renameTo(StorageFile newName) Rename the file denoted by this name. Note that StorageFile objects are immutable. This method renames the underlying file, it does not change this StorageFile object. The StorageFile object denotes the same name as before, however the exists() method will return false after the renameTo method executes successfully. It is not specified whether this method will succeed if a file already exists under the new name.
| |
| setReadOnly | back to summary |
|---|---|
| public boolean setReadOnly() Make the named file or directory read-only. This interface does not specify whether this also makes the file undeletable.
| |