|
|||||||||
| 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()
Adds the classpath as paths in the MergePath. |
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 |
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. |
Path |
getBestPath()
Returns the first matching 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 |
getRelativePath()
Returns the relative path into the merge path. |
java.util.ArrayList |
getResources()
Returns all the resources matching the path. |
java.util.ArrayList |
getResources(java.lang.String pathName)
Returns all the resources matching the path. |
java.lang.String |
getScheme()
Returns the scheme 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()
List the merged directories. |
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, equals, getParent, getPath, getTail, getURL, getUserPath, hashCode, 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, 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()
public 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 FilesystemPathcom.caucho.vfs.FilesystemPathuserPath - 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 Pathpublic java.lang.String getFullPath()
getFullPath in class FilesystemPathpublic java.lang.String getRelativePath()
public boolean exists()
exists in class Pathpublic boolean isDirectory()
isDirectory in class Pathpublic boolean isFile()
isFile in class Pathpublic long getLength()
getLength in class Pathcom.caucho.vfs.Pathpublic long getLastModified()
getLastModified in class Pathcom.caucho.vfs.Pathpublic boolean canRead()
canRead in class Pathpublic boolean canWrite()
canWrite in class Pathpublic java.util.ArrayList getResources(java.lang.String pathName)
getResources in class Pathpublic java.util.ArrayList getResources()
getResources in class Path
public java.lang.String[] list()
throws java.io.IOException
list in class Pathcom.caucho.vfs.Path
public boolean mkdir()
throws java.io.IOException
mkdir in class Pathcom.caucho.vfs.Path
public boolean mkdirs()
throws java.io.IOException
mkdirs in class Pathcom.caucho.vfs.Path
public boolean remove()
throws java.io.IOException
remove in class Pathcom.caucho.vfs.Path
public boolean renameTo(Path path)
throws java.io.IOException
renameTo in class Pathcom.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 Pathpublic Path getBestPath()
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 | ||||||||