A virtual file is not created until one of the following methods are invoked:
createNewFile
getOutputStream
getRandomAccessFile
mkdir
mkdirs
When a method that requires access to the file data or to know if the file exists or not, the associated data store is consulted.
| Modifier and Type | Field and Description |
|---|---|
| private final DataStore | dStore
The data store this virtual file belongs to. |
| private final String | path
The path of this virtual file. |
| Access | Constructor and Description |
|---|---|
| public | VirtualFile(String
the path of this virtual file path, DataStore the store this handle belongs to dbData)Creates a new virtual file handle. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if this file exists and can be written to,
false otherwise.Implements org. Tells if this file can be written to. |
| public boolean | Returns: true if the file was successfully created, false
otherwiseImplements org. Creates the the file denoted by this virtual file object. |
| public boolean | Returns: true if this file exists and is successfully deleted,
false otherwise.Implements org. Deletes this file, of if exists. |
| public boolean | Returns: true if this file and all contents are successfully
deleted, false otherwise.Implements org. Deletes the path denoted by this file and all its contents, including sub directories. |
| public boolean | Returns: true if this file exists, false otherwise.Implements org. Tells if this file exists. |
| public String | getCanonicalPath()
Implements org. Converts this StorageFile into a canonical pathname string. |
| private DataStoreEntry | Returns: The assoiciatedDataStoreEntry if it exists,
null if it doesn't exist.Returns the data store entry denoted by this file, if it exists. |
| public int | getExclusiveFileLock()
Implements org. Get an exclusive lock with this name. |
| public InputStream | Returns: AnInputStream instance.Implements org. Returns an input stream for the file denoted. |
| public String | |
| public OutputStream | Returns: AnOutputStream-instance.Implements org. Obtains an output stream for the file denoted. |
| public OutputStream | Returns: AnOutputStream-instance.tells if the file should be appended or truncated append)Implements org. Obtains an output stream for the file denoted. |
| public StorageFile | getParentDir()
Implements org. Get the name of the parent directory if this name includes a parent. |
| public String | Returns: The path of this file.Implements org. Returns the path of this file. |
| public StorageRandomAccessFile | Returns: AStorageRandomAccessFile-instance.file mode, one of "r", "rw", "rws" or "rwd" (lower-case
letters are required) mode)Implements org. Creates a random access file that can be used to read and write from/into the file. |
| public boolean | Returns: true if this file represents an existing directoy,
false otherwise.Implements org. Tells if this file is a directory. |
| public long | Returns: The length of the existing file, or0 if the path denotes
a directory or a non-existing file.Returns the length of the file. |
| public void | limitAccessToOwner()
Implements org. Use when creating a new file. |
| public String[] | Returns: A list of all files and directories, ornull if this file
doesn't denote a directory or doesn't exist.Implements org. Returns the contents of the directory denoted by this file, including any sub directories and their contents. |
| public boolean | Returns: true if the directory was created, false
otherwise.Implements org. Creates the directory denoted by this virtual file if it doesn't exist. |
| public boolean | Returns: true if the directory was created, false
otherwise.Implements org. Creates the directory and any parent directories denoted by this virtual file. |
| public void | releaseExclusiveFileLock()
Implements org. Release the resource associated with an earlier acquired exclusive lock releaseExclusiveFileLock() may delete the file |
| public boolean | Returns: true if the fail was renamed, false otherwisethe new name newName)Implements org. Renames the file denoted by this handle. |
| public boolean | setReadOnly()
Implements org. Make the named file or directory read-only. |
| public String | Returns: Textual representation.Overrides java. Returns a textual representation of this file. |
| dStore | back to summary |
|---|---|
| private final DataStore dStore The data store this virtual file belongs to. | |
| path | back to summary |
|---|---|
| private final String path The path of this virtual file. | |
| VirtualFile | back to summary |
|---|---|
| public VirtualFile(String path, DataStore dbData) Creates a new virtual file handle. | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite() Implements org. Tells if this file can be written to.
| |
| createNewFile | back to summary |
|---|---|
| public boolean createNewFile() Implements org. Creates the the file denoted by this virtual file object.
| |
| delete | back to summary |
|---|---|
| public boolean delete() Implements org. Deletes this file, of if exists.
| |
| deleteAll | back to summary |
|---|---|
| public boolean deleteAll() Implements org. Deletes the path denoted by this file and all its contents, including sub directories.
| |
| exists | back to summary |
|---|---|
| public boolean exists() Implements org. Tells if this file exists.
| |
| getCanonicalPath | back to summary |
|---|---|
| public String getCanonicalPath() Implements org. Doc from org. Converts this StorageFile into a canonical pathname string. The form of the canonical path is system dependent.
| |
| getEntry | back to summary |
|---|---|
| private DataStoreEntry getEntry() Returns the data store entry denoted by this file, if it exists.
| |
| getExclusiveFileLock | back to summary |
|---|---|
| public int getExclusiveFileLock() throws StandardException Implements org. Doc from org. 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 Implements org. Returns an input stream for the file denoted.
| |
| getName | back to summary |
|---|---|
| public String getName() Implements org.
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream() throws FileNotFoundException Implements org. Obtains an output stream for the file denoted. If the file already exists, it will be truncated.
| |
| getOutputStream | back to summary |
|---|---|
| public OutputStream getOutputStream(boolean append) throws FileNotFoundException Implements org. Obtains an output stream for the file denoted.
| |
| getParentDir | back to summary |
|---|---|
| public StorageFile getParentDir() Implements org. Doc from org. Get the name of the parent directory if this name includes a parent.
| |
| getPath | back to summary |
|---|---|
| public String getPath() Implements org. Returns the path of this file.
| |
| getRandomAccessFile | back to summary |
|---|---|
| public StorageRandomAccessFile getRandomAccessFile(String mode) throws FileNotFoundException Implements org. Creates a random access file that can be used to read and write from/into the file.
| |
| isDirectory | back to summary |
|---|---|
| public boolean isDirectory() Implements org. Tells if this file is a directory.
Note that
| |
| length | back to summary |
|---|---|
| public long length() Returns the length of the file.
If the file doesn't exists, or is a directory,
| |
| limitAccessToOwner | back to summary |
|---|---|
| public void limitAccessToOwner() Implements org. Doc from org. 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() Implements org. Returns the contents of the directory denoted by this file, including any sub directories and their contents.
| |
| mkdir | back to summary |
|---|---|
| public boolean mkdir() Implements org. Creates the directory denoted by this virtual file if it doesn't exist. For the directory to be created, it cannot exist already (either as a file or a directory), and any parent directories must exist.
| |
| mkdirs | back to summary |
|---|---|
| public boolean mkdirs() Implements org. Creates the directory and any parent directories denoted by this virtual file. For the directory to be created, it cannot exist already (either as a file or a directory), and all the parent elements most denote either existing directories or non-existing paths.
| |
| releaseExclusiveFileLock | back to summary |
|---|---|
| public void releaseExclusiveFileLock() Implements org. Doc from org. Release the resource associated with an earlier acquired exclusive lock releaseExclusiveFileLock() may delete the file | |
| renameTo | back to summary |
|---|---|
| public boolean renameTo(StorageFile newName) Implements org. Renames the file denoted by this handle.
| |
| setReadOnly | back to summary |
|---|---|
| public boolean setReadOnly() Implements org. Doc from org. Make the named file or directory read-only. This interface does not specify whether this also makes the file undeletable.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a textual representation of this file.
| |