|
|||||||||
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.ZipFilesystem
The ZipFilesystem provides a direct mapping of Filesystem operations onto zip file entries. The protocol, host and anchor portions of a Url are ignored by the zip filesystem. It is assumed that the VFS will direct only "zip" protocol Url actions to this filesystem.
The file portion of the Url must be of the format [<zipfile>]/
Note that the use of the square bracket, which may also be a legal character in a filename on some file systems, is a potential problem in many cases. The presence of a ']' in the path to a zip file will prevent any access to the contents of the Zip, and ']' in a relative path has special meaning.
Field Summary | |
static ZipFilesystem |
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)
Always fails because zip filesystems are always read-only. |
boolean |
exists(Url url)
Tests if the zip file entry represented by the specified Url actually exists. |
boolean |
fileEquals(Url url,
Url otherUrl)
Compares the file portion of two Url objects. |
int |
fileHashCode(Url url)
Produces a hash value for the file portion of a Url compatible with the definition of equality provided by fileEquals . |
Url |
getAbsoluteUrl(java.lang.String newHost,
java.lang.String absoluteFilePath)
Assists in interpreting a relative path by creating a full Url for a zip path if it represents an absolute path. |
Url |
getCanonicalUrl(Url url)
Reports the actual filename for zip filename portion of the specified Url. |
Url[] |
getChildren(Url url,
RegularExpression[] patterns,
int type)
Retrieves a list of Urls representing file and directory entries within the directory represented by the specified Url. |
java.io.File |
getFileObject(Url url)
Describes a Url in terms of a java.io.File instance. |
java.io.InputStream |
getInputStream(Url url)
Creates an InputStream that reads from the zip file entry represented by the specified Url. |
long |
getLastModified(Url url)
Reports the time at which the zip file entry represented by the specified Url was last modified. |
java.lang.String |
getName(Url url)
Returns a short name for the Url. |
java.io.OutputStream |
getOutputStream(Url url,
boolean makeBackup)
Always fails because zip filesystems are always read-only. |
Url |
getParent(Url url)
Returns a Url with the last subpath from the supplied Url's file path removed. |
java.lang.String |
getProtocol()
|
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 zip path represented by the specified Url maps to a directory containing one of the actual zip entries. |
boolean |
isReadOnly(Url url)
All entries in a zip filesystem are read only. |
boolean |
isValid(Url url)
Determines whether the state of a Url instance is valid. |
static java.lang.String |
stripArchivePrefix(java.lang.String filename)
Will remove the name of the archive from the front of a string Example: [C:/JBUILDER/myclasses/Untitled1.jar]/untitled7/DataModule2.class will return "/untitled7/DataModule2.class" |
Methods inherited from class com.borland.primetime.vfs.AbstractFilesystem |
getChild |
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 ZipFilesystem 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 zip file entry to be read.public java.io.OutputStream getOutputStream(Url url, boolean makeBackup) throws java.io.IOException
url
- Ignored.makeBackup
- Ignored.public boolean isReadOnly(Url url)
url
- Ignored.public long getLastModified(Url url)
url
- The zip entry to be tested.public Url getCanonicalUrl(Url url)
url
- The zip file and entry.public boolean exists(Url url)
url
- The zip file entry to be tested.public void delete(Url url) throws java.io.IOException
url
- Ignored.public boolean isDirectory(Url url)
url
- The zip path to be tested.public Url[] getChildren(Url url, RegularExpression[] patterns, int type)
url
- The logical 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 getParent(Url url)
The parent of a ZipFilesystem Url may belong to the FileFilesystem if the closing square bracket is removed along with the final subpath.
url
- The Url for which a parent is desired.public Url getAbsoluteUrl(java.lang.String newHost, java.lang.String absoluteFilePath)
public java.lang.String getName(Url url)
public java.io.File getFileObject(Url url)
java.io.File
instance. This
will result in a reference to the outer archive file regardless of the
actual internal reference since there is only one physical file present.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 start from a zip and "escape" by backing up enough times that the
path no longer has a trailing square bracket. The overridden
getChild
detects this case.
Deals with absolute paths by using the FileFilesystem implementation of getAbsoluteUrl.
root
- The Url root.relativePath
- The relative path from the root.public int fileHashCode(Url url)
fileEquals
.url
- The Url to produce a hash value based on.public boolean fileEquals(Url url, Url otherUrl)
url
- The first of the two Urls to be compared.otherUrl
- The second of the two Urls to be compared.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.public static java.lang.String stripArchivePrefix(java.lang.String filename)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |