|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.borland.primetime.vfs.AbstractFilesystem | +--com.borland.primetime.vfs.FileFilesystem
The FileFilesystem provides a direct mapping of Filesystem operations onto native file and directory access. The protocol, host and anchor portions of a Url are ignored by the file filesystem. It is assumed that the VFS will direct only "file" protocol Url actions to this filesystem, and that the file portion of the Url will contain an absolute path using forward slashes as directory separators regardless of the underlying operating system.
Field Summary | |
static FileFilesystem |
FILESYSTEM
|
static java.lang.String |
PROTOCOL
|
Fields inherited from interface com.borland.primetime.vfs.Filesystem |
TYPE_BOTH,
TYPE_DIRECTORY,
TYPE_FILE |
Method Summary | |
void |
delete(Url url)
Deletes the file respresented by the specified Url. |
boolean |
exists(Url url)
Tests if the file represented by the specified Url actually exists. |
boolean |
fileEquals(Url url,
Url otherUrl)
Compares two file Urls based on the java.io.File objects provided by getFileObject . |
int |
fileHashCode(Url url)
Provides a hashcode based on the java.io.File object produced by getFileObject . |
Url |
getAbsoluteUrl(java.lang.String newHost,
java.lang.String absoluteFilePath)
Assists in interpreting a relative path by creating a full Url for a file path if it represents an absolute path. |
Url |
getCanonicalUrl(Url url)
Reports the actual filename for file represented by the specified Url. |
Url |
getChild(Url url,
java.lang.String subpath)
Creates a new Url that adds the specified subpath to an existing Url's file path. |
Url[] |
getChildren(Url url,
RegularExpression[] patterns,
int type)
Retrieves a list of Urls representing files and other directories within the directory represented by the specified Url. |
java.io.File |
getFileObject(Url url)
Returns a java.io.File object that corresponds to a given Url. |
java.io.InputStream |
getInputStream(Url url)
Creates an InputStream that reads from the file represented by the specified Url. |
long |
getLastModified(Url url)
Reports the time at which the file represented by the specified Url was last modified. |
java.io.OutputStream |
getOutputStream(Url url,
boolean makeBackup)
Creates an OutputStream that writes to the file represented by the specified Url. |
Url |
getParent(Url url)
Returns a Url with the last subpath from the supplied Url's file path removed. |
java.lang.String |
getProtocol()
Returns the name of the file protocol. |
java.lang.String |
getRelativePath(Url root,
Url target,
boolean onlyChildren)
Create a relative path from an root Url to specified target Url. |
Url |
getRelativeUrl(Url root,
java.lang.String relativePath)
Create a new Url from an existing root Url and a relative component. |
static void |
initOpenTool(byte majorVersion,
byte minorVersion)
OpenTool initialization |
boolean |
isDirectory(Url url)
Tests if the filename represented by the specified Url is actually a directory. |
boolean |
isReadOnly(Url url)
Tests if the file represented by the specified Url is read only. |
boolean |
isValid(Url url)
Determines whether the state of a Url instance is valid. |
Methods inherited from class com.borland.primetime.vfs.AbstractFilesystem |
getName |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String PROTOCOL
public static final FileFilesystem FILESYSTEM
Method Detail |
public static void initOpenTool(byte majorVersion, byte minorVersion)
public java.lang.String getProtocol()
public java.io.InputStream getInputStream(Url url) throws java.io.IOException
url
- The file to be read.public java.io.OutputStream getOutputStream(Url url, boolean makeBackup) throws java.io.IOException
url
- The file to be written.makeBackup
- True if the filesystem should make a backup first.public boolean isReadOnly(Url url)
url
- The file to be tested.public long getLastModified(Url url)
url
- The file to be tested.public Url getCanonicalUrl(Url url)
url
- The file.public boolean exists(Url url)
url
- The file to be tested.public void delete(Url url) throws java.io.IOException
url
- The file to be deleted.public boolean isDirectory(Url url)
url
- The filename to be tested.public Url[] getChildren(Url url, RegularExpression[] patterns, int type)
url
- The directory to scan.pattern
- An array of regular expressions constraining the set of
values that will be returned. Only children whose final path component
exactly matches at least one of the patterns will be represented in the
resulting array. Note that a null array matches all children and that
directories are not compared against the patterns, only files.type
- The constants TYPE_DIRECTORY
,
TYPE_FILE
, and TYPE_BOTH
can be used to control
the type of resources that are represented in the result array.public Url getChild(Url url, java.lang.String subpath)
When a new subpath terminating in a square bracket is detected, the newly created Url will belong to the ZipFilesystem rather than the FileFilesystem, and a leading square bracket will be prepended to match the closing bracket.
url
- The existing Url.subpath
- The subpath to be added to the Url's file path.public Url getParent(Url url)
url
- The Url for which a parent is desired.public Url getAbsoluteUrl(java.lang.String newHost, java.lang.String absoluteFilePath)
public int fileHashCode(Url url)
getFileObject
.url
- The Url for which a hashcode should be computed.public boolean fileEquals(Url url, Url otherUrl)
getFileObject
. This provides compatibility with local
filesystem rules for case sensitivity or lack thereof.url
- The first of the Urls to compare.otherUrl
- The second of the Urls to compare.public java.io.File getFileObject(Url url)
url
- The Url in question.public Url getRelativeUrl(Url root, java.lang.String relativePath)
Deals with the additional complications of zip-relative pathing, which may look like: [path1/path2]/path3/path4 by stripping off the leading square bracket using one of two techniques:
getChild
detects the trailing
aquare bracket and takes care of the conversion.Deals with absolute Zip paths by using the ZipFilesystem implementation of getAbsoluteUrl.
root
- The Url root.relativePath
- The relative path from the root.public boolean isValid(Url url)
url
- The Url in question.public java.lang.String getRelativePath(Url root, Url target, boolean onlyChildren)
root
- The Url root.target
- The Url target.onlyChildren
- True if the target must be a descendant of the root,
false if absolute paths and paths with leading "../" entries should be
considered.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |