| java.lang.Object org.apache.derby.impl.io.InputStreamFile
All known Subclasses: org.apache.derby.impl.io.CPFile, org.apache.derby.impl.io.URLFile, org.apache.derby.impl.io.JarDBFile,
InputStreamFile | abstract class InputStreamFile implements StorageFile(Code) | | This class provides the base for read-only stream implementations of the StorageFile interface. It is used with the
classpath, jar, http, and https subsubprotocols
|
Method Summary | |
public boolean | canWrite() Determine whether the named file is writable. | public boolean | createNewFile() 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.
true if this thread's invocation of createNewFile successfully created the named file;false if not, i.e. | public boolean | delete() Deletes the named file or empty directory. | public boolean | deleteAll() Deletes the named file and, if it is a directory, all the files and directories it contains. | public boolean | equals(Object other) | abstract public boolean | exists() Tests whether the named file exists. | public String | getCanonicalPath() | public int | getExclusiveFileLock() Get an exclusive lock with this name. | abstract public InputStream | getInputStream() Creates an input stream from a file name. | public String | getName() | public OutputStream | getOutputStream() Creates an output stream from a file name. | public OutputStream | getOutputStream(boolean append) Creates an output stream from a file name. | public StorageFile | getParentDir() Get the name of the parent directory if this name includes a parent. | abstract StorageFile | getParentDir(int pathLen) Get the parent of this file. | public String | getPath() Converts this StorageFile into a pathname string. | public StorageRandomAccessFile | getRandomAccessFile(String mode) Get a random access file.
Parameters: mode - "r", "rw", "rws", or "rwd". | public URL | getURL() | public int | hashCode() | public boolean | isDirectory() Tests whether the named file is a directory, or not. | public long | length() Returns the length of the named file if it is not a directory. | public String[] | list() Get the names of all files and sub-directories in the directory named by this path name.
An array of the names of the files and directories in thisdirectory denoted by this abstract pathname. | public boolean | mkdir() Creates the named directory. | public boolean | mkdirs() Creates the named directory, and all nonexistent parent directories. | public void | releaseExclusiveFileLock() | public boolean | renameTo(StorageFile newName) Rename the file denoted by this name. | public boolean | setReadOnly() Make the named file or directory read-only. | public String | toString() Get the file name for diagnostic purposes. |
nameStart | final int nameStart(Code) | | |
canWrite | public boolean canWrite()(Code) | | Determine whether the named file is writable.
true if the file exists and is writable, false if not. |
createNewFile | public boolean createNewFile() throws IOException(Code) | | 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.
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. exception: IOException - - If the directory does not exist or some other I/O error occurred |
delete | public boolean delete()(Code) | | Deletes the named file or empty directory. This method does not delete non-empty directories.
true if the named file or directory is successfully deleted, false if not |
deleteAll | public boolean deleteAll()(Code) | | Deletes the named file and, if it is a directory, all the files and directories it contains.
true if the named file or directory is successfully deleted, false if not |
exists | abstract public boolean exists()(Code) | | Tests whether the named file exists.
true if the named file exists, false if not. |
getExclusiveFileLock | public int getExclusiveFileLock()(Code) | | 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.
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.
|
getName | public String getName()(Code) | | The last segment in the path name, "" if the path name sequence is empty. |
getOutputStream | public OutputStream getOutputStream() throws FileNotFoundException(Code) | | 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.
an output stream suitable for writing to the file. exception: FileNotFoundException - if the file exists but is a directoryrather than a regular file, does not exist but cannot be created, orcannot be opened for any other reason. |
getOutputStream | public OutputStream getOutputStream(boolean append) throws FileNotFoundException(Code) | | 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.
an output stream suitable for writing to the file. exception: FileNotFoundException - if the file exists but is a directoryrather than a regular file, does not exist but cannot be created, orcannot be opened for any other reason. |
getParentDir | public StorageFile getParentDir()(Code) | | Get the name of the parent directory if this name includes a parent.
An StorageFile denoting the parent directory of this StorageFile, if it has a parent, null ifit does not have a parent. |
getParentDir | abstract StorageFile getParentDir(int pathLen)(Code) | | Get the parent of this file.
Parameters: pathLen - the length of the parent's path name. |
getPath | public String getPath()(Code) | | 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.
The pathname as a string. See Also: StorageFactory.getSeparator |
getRandomAccessFile | public StorageRandomAccessFile getRandomAccessFile(String mode) throws FileNotFoundException(Code) | | Get a random access file.
Parameters: mode - "r", "rw", "rws", or "rwd". The "rws" and "rwd" modes specifythat the data is to be written to persistent store, consistent with thejava.io.RandomAccessFile class ("synchronized" with the persistentstorage, in the file system meaning of the word "synchronized"). Howeverthe implementation is not required to implement the "rws" or "rwd"modes. The implementation may treat "rws" and "rwd" as "rw". It is up tothe user of this interface to call the StorageRandomAccessFile.syncmethod. However, if the "rws" or "rwd" modes are supported and theRandomAccessFile was opened in "rws" or "rwd" mode then theimplementation of StorageRandomAccessFile.sync need not do anything. an object that can be used for random access to the file. exception: IllegalArgumentException - if the mode argument is not equal to one of "r", "rw", "rws", or "rwd". exception: FileNotFoundException - if the file exists but is a directory rather than a regularfile, or cannot be opened or created for any other reason . See Also: java.io.RandomAccessFile |
hashCode | public int hashCode()(Code) | | |
isDirectory | public boolean isDirectory()(Code) | | Tests whether the named file is a directory, or not. This is only called in writable storage factories.
true if named file exists and is a directory, false if not.The return value is undefined if the storage is read-only. |
length | public long length()(Code) | | Returns the length of the named file if it is not a directory. The return value is not specified
if the file is a directory.
The length, in bytes, of the named file if it exists and is not a directory,0 if the file does not exist, or any value if the named file is a directory. |
list | public String[] list()(Code) | | Get the names of all files and sub-directories in the directory named by this path name.
An array of the names of the files and directories in thisdirectory denoted by this abstract pathname. The returned array will have length 0if this directory is empty. Returns null if this StorageFile is not a directory, orif an I/O error occurs. |
mkdir | public boolean mkdir()(Code) | | Creates the named directory.
true if the directory was created; false if not. |
mkdirs | public boolean mkdirs()(Code) | | Creates the named directory, and all nonexistent parent directories.
true if the directory was created, false if not |
renameTo | public boolean renameTo(StorageFile newName)(Code) | | 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.
Parameters: newName - the new name. true if the rename succeeded, false if not. |
setReadOnly | public boolean setReadOnly()(Code) | | Make the named file or directory read-only. This interface does not specify whether this
also makes the file undeletable.
true if the named file or directory was made read-only, or it already was read-only;false if not. |
toString | public String toString()(Code) | | Get the file name for diagnostic purposes. Usually the same as getPath().
the file name |
|
|