|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.vfs.Path | +--com.caucho.vfs.FilesystemPath | +--com.caucho.vfs.MergePath
A merging of several Paths used like a CLASSPATH. When the MergePath is opened, the first path in the list which contains the file will be the opened file.
In the following example, "first" has priority over "second".
If test.xml exists in both "first" and "second", the open will
return "first/test.xml".
MergePage merge = new MergePath();
merge.addMergePath(Vfs.lookup("first");
merge.addMergePath(Vfs.lookup("second");
Path path = merge.lookup("test.xml");
ReadStream is = path.openRead();
Fields inherited from class com.caucho.vfs.FilesystemPath |
bindRoot, pathname, root, separatorChar, userPath |
Fields inherited from class com.caucho.vfs.Path |
L, schemeMap |
Constructor Summary | |
MergePath()
Creates a new merge path. |
Method Summary | |
void |
addClassPath(java.lang.ClassLoader loader)
Adds the classpath for the loader as paths in the MergePath. |
void |
addMergePath(Path path)
Adds a new path to the end of the merge path. |
boolean |
canRead()
Returns true if the best path can be read. |
boolean |
canWrite()
Returns true if the best path can be written to. |
boolean |
equals(java.lang.Object b)
Returns true if the best path matches b's best path. |
boolean |
exists()
True if any file matching this path exists. |
protected Path |
fsWalk(java.lang.String userPath,
java.util.Map attributes,
java.lang.String path)
Walking down the path just extends the path. |
java.lang.String |
getFullPath()
Returns the full path name of the best path. |
long |
getLastModified()
Returns the last modified time of the best path. |
long |
getLength()
Returns the length of the best path. |
java.util.ArrayList |
getMergePaths()
Return the list of paths searched in the merge path. |
java.lang.String |
getScheme()
Returns the scheme of the best path. |
int |
hashCode()
Returns the hashCode of the best path. |
boolean |
isDirectory()
True if the best path is a directory. |
boolean |
isFile()
True if the best path is a file. |
java.lang.String[] |
list()
Should list the merged directories, but not implemented yet. |
boolean |
mkdir()
XXX: Probably should mkdir in the first path |
boolean |
mkdirs()
XXX: Probably should mkdir in the first path |
StreamImpl |
openAppendImpl()
Opens the best path for appending. |
StreamImpl |
openReadImpl()
Opens the best path for reading. |
StreamImpl |
openReadWriteImpl()
Opens the best path for reading and writing. |
StreamImpl |
openWriteImpl()
Opens the best path for writing. |
boolean |
remove()
Remove the matching path. |
boolean |
renameTo(Path path)
Renames the path. |
java.lang.String |
toString()
Returns a name for the path |
Methods inherited from class com.caucho.vfs.FilesystemPath |
bind, copy, createRoot, getParent, getPath, getTail, getURL, getUserPath, normalizePath, normalizePath, schemeWalk, setUserPath |
Methods inherited from class com.caucho.vfs.Path |
createNewFile, createRoot, createTempFile, getAttribute, getAttributeNames, getContentType, getHost, getNativePath, getObject, getPort, getQuery, getValue, isObject, iterator, lookup, lookup, lookupNative, lookupNative, openAppend, openRead, openReadWrite, openWrite, removeAttribute, renameTo, scanScheme, setAttribute, setLastModified, setObject, setValue, unbind, writeToStream |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MergePath()
Method Detail |
public void addMergePath(Path path)
path
- the new path to searchpublic void addClassPath(java.lang.ClassLoader loader)
loader
- class loader whose classpath should be used to search.public java.util.ArrayList getMergePaths()
protected Path fsWalk(java.lang.String userPath, java.util.Map attributes, java.lang.String path)
fsWalk
in class FilesystemPath
com.caucho.vfs.FilesystemPath
userPath
- the exact string passed by the user's lookup()newAttributes
- the user's new attributesnewPath
- the normalized real pathpublic java.lang.String getScheme()
getScheme
in class Path
public java.lang.String getFullPath()
getFullPath
in class FilesystemPath
public boolean exists()
exists
in class Path
public boolean isDirectory()
isDirectory
in class Path
public boolean isFile()
isFile
in class Path
public long getLength()
getLength
in class Path
com.caucho.vfs.Path
public long getLastModified()
getLastModified
in class Path
com.caucho.vfs.Path
public boolean canRead()
canRead
in class Path
public boolean canWrite()
canWrite
in class Path
public java.lang.String[] list() throws java.io.IOException
list
in class Path
com.caucho.vfs.Path
public boolean mkdir() throws java.io.IOException
mkdir
in class Path
com.caucho.vfs.Path
public boolean mkdirs() throws java.io.IOException
mkdirs
in class Path
com.caucho.vfs.Path
public boolean remove() throws java.io.IOException
remove
in class Path
com.caucho.vfs.Path
public boolean renameTo(Path path) throws java.io.IOException
renameTo
in class Path
com.caucho.vfs.Path
public StreamImpl openReadImpl() throws java.io.IOException
openReadImpl
in class Path
public StreamImpl openWriteImpl() throws java.io.IOException
openWriteImpl
in class Path
public StreamImpl openReadWriteImpl() throws java.io.IOException
openReadWriteImpl
in class Path
public StreamImpl openAppendImpl() throws java.io.IOException
openAppendImpl
in class Path
public int hashCode()
hashCode
in class FilesystemPath
public boolean equals(java.lang.Object b)
equals
in class FilesystemPath
public java.lang.String toString()
toString
in class FilesystemPath
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |