|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.io.InputStreamFile
abstract class InputStreamFile
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
Field Summary | |
---|---|
(package private) int |
nameStart
|
(package private) java.lang.String |
path
|
(package private) BaseStorageFactory |
storageFactory
|
Fields inherited from interface org.apache.derby.io.StorageFile |
---|
EXCLUSIVE_FILE_LOCK, EXCLUSIVE_FILE_LOCK_NOT_AVAILABLE, NO_FILE_LOCK_SUPPORT |
Constructor Summary | |
---|---|
InputStreamFile(BaseStorageFactory storageFactory,
java.lang.String path)
|
|
InputStreamFile(BaseStorageFactory storageFactory,
java.lang.String child,
int pathLen)
|
|
InputStreamFile(BaseStorageFactory storageFactory,
java.lang.String parent,
java.lang.String name)
|
|
InputStreamFile(InputStreamFile dir,
java.lang.String name)
|
Method Summary | |
---|---|
boolean |
canWrite()
Determine whether the named file is writable. |
boolean |
createNewFile()
If the named file does not already exist then create it as an empty normal file. |
boolean |
delete()
Deletes the named file or empty directory. |
boolean |
deleteAll()
Deletes the named file and, if it is a directory, all the files and directories it contains. |
boolean |
equals(java.lang.Object other)
|
abstract boolean |
exists()
Tests whether the named file exists. |
java.lang.String |
getCanonicalPath()
Converts this StorageFile into a canonical pathname string. |
int |
getExclusiveFileLock()
Get an exclusive lock with this name. |
abstract java.io.InputStream |
getInputStream()
Creates an input stream from a file name. |
java.lang.String |
getName()
|
java.io.OutputStream |
getOutputStream()
Creates an output stream from a file name. |
java.io.OutputStream |
getOutputStream(boolean append)
Creates an output stream from a file name. |
StorageFile |
getParentDir()
Get the name of the parent directory if this name includes a parent. |
(package private) abstract StorageFile |
getParentDir(int pathLen)
Get the parent of this file. |
java.lang.String |
getPath()
Converts this StorageFile into a pathname string. |
StorageRandomAccessFile |
getRandomAccessFile(java.lang.String mode)
Get a random access file. |
java.net.URL |
getURL()
Get a URL representing this file. |
int |
hashCode()
|
boolean |
isDirectory()
Tests whether the named file is a directory, or not. |
long |
length()
Returns the length of the named file if it is not a directory. |
java.lang.String[] |
list()
Get the names of all files and sub-directories in the directory named by this path name. |
boolean |
mkdir()
Creates the named directory. |
boolean |
mkdirs()
Creates the named directory, and all nonexistent parent directories. |
void |
releaseExclusiveFileLock()
Release the resource associated with an earlier acquired exclusive lock |
boolean |
renameTo(StorageFile newName)
Rename the file denoted by this name. |
boolean |
setReadOnly()
Make the named file or directory read-only. |
java.lang.String |
toString()
Get the file name for diagnostic purposes. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
final java.lang.String path
final int nameStart
final BaseStorageFactory storageFactory
Constructor Detail |
---|
InputStreamFile(BaseStorageFactory storageFactory, java.lang.String path)
InputStreamFile(BaseStorageFactory storageFactory, java.lang.String parent, java.lang.String name)
InputStreamFile(InputStreamFile dir, java.lang.String name)
InputStreamFile(BaseStorageFactory storageFactory, java.lang.String child, int pathLen)
Method Detail |
---|
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String[] list()
list
in interface StorageFile
public boolean canWrite()
canWrite
in interface StorageFile
public abstract boolean exists()
exists
in interface StorageFile
public boolean isDirectory()
isDirectory
in interface StorageFile
public boolean delete()
delete
in interface StorageFile
public boolean deleteAll()
deleteAll
in interface StorageFile
public java.lang.String getPath()
The returned path may include the database directory. Therefore it cannot be directly used to make an StorageFile equivalent to this one.
getPath
in interface StorageFile
StorageFactory.getSeparator()
public java.lang.String getCanonicalPath() throws java.io.IOException
StorageFile
getCanonicalPath
in interface StorageFile
java.io.IOException
- if an I/O error occurred while finding the canonical namepublic java.lang.String getName()
getName
in interface StorageFile
public boolean createNewFile() throws java.io.IOException
createNewFile
in interface StorageFile
java.io.IOException
- - If the directory does not exist or some other I/O error occurredpublic boolean renameTo(StorageFile newName)
It is not specified whether this method will succeed if a file already exists under the new name.
renameTo
in interface StorageFile
newName
- the new name.
public boolean mkdir()
mkdir
in interface StorageFile
public boolean mkdirs()
mkdirs
in interface StorageFile
public long length()
length
in interface StorageFile
public StorageFile getParentDir()
getParentDir
in interface StorageFile
abstract StorageFile getParentDir(int pathLen)
pathLen
- the length of the parent's path name.public boolean setReadOnly()
setReadOnly
in interface StorageFile
public java.io.OutputStream getOutputStream() throws java.io.FileNotFoundException
getOutputStream
in interface StorageFile
java.io.FileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot be created, or
cannot be opened for any other reason.public java.io.OutputStream getOutputStream(boolean append) throws java.io.FileNotFoundException
getOutputStream
in interface StorageFile
append
- 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.
java.io.FileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot be created, or
cannot be opened for any other reason.public abstract java.io.InputStream getInputStream() throws java.io.FileNotFoundException
getInputStream
in interface StorageFile
java.io.FileNotFoundException
- if the file is not found.public int getExclusiveFileLock()
getExclusiveFileLock
in interface StorageFile
public void releaseExclusiveFileLock()
releaseExclusiveFileLock
in interface StorageFile
getExclusiveFileLock()
public StorageRandomAccessFile getRandomAccessFile(java.lang.String mode) throws java.io.FileNotFoundException
getRandomAccessFile
in interface StorageFile
mode
- "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. The implementation may treat "rws" and "rwd" as "rw". It is up to
the user of this interface to call the StorageRandomAccessFile.sync
method. 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.
java.lang.IllegalArgumentException
- if the mode argument is not equal to one of "r", "rw", "rws", or "rwd".
java.io.FileNotFoundException
- if the file exists but is a directory rather than a regular
file, or cannot be opened or created for any other reason .public java.lang.String toString()
toString
in class java.lang.Object
public java.net.URL getURL() throws java.net.MalformedURLException
StorageFile
getURL
in interface StorageFile
java.net.MalformedURLException
- File cannot be represented as a URL.StorageFile.getURL()
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |