|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.vfs.Path
com.caucho.vfs.FilesystemPath
com.caucho.vfs.MergePath
public class MergePath
A merging of several Paths used like a CLASSPATH. When the MergePath is opened for read, the first path in the list which contains the file will be the opened file. When the MergePath is opened for write, the first path in the list is used for the write.
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();
MergePath corresponds to the "merge:" Vfs schema
Path path = Vfs.lookup("merge:(../custom-foo;foo)");
| Field Summary |
|---|
| Fields inherited from class com.caucho.vfs.FilesystemPath |
|---|
_bindRoot, _pathname, _root, _userPath |
| Fields inherited from class com.caucho.vfs.Path |
|---|
_pathSeparatorChar, _schemeMap, _separatorChar, L |
| 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 |
addClassPath(java.lang.String classpath)
Adds the classpath for the loader as paths in the MergePath. |
void |
addLocalClassPath()
Adds the classpath as paths in the MergePath. |
void |
addLocalClassPath(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. |
void |
addResourceClassPath(java.lang.ClassLoader loader)
Adds the classpath for the loader as paths in the MergePath. |
boolean |
canRead()
Returns true if the best path can be read. |
boolean |
canWrite()
Returns true if the best path can be written to. |
PersistentDependency |
createDepend()
Creates a dependency. |
boolean |
exists()
True if any file matching this path exists. |
Path |
fsWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> 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<Path> |
getMergePaths()
Return the list of paths searched in the merge path. |
java.lang.String |
getNativePath()
Returns the full native path name of the best path. |
java.lang.String |
getRelativePath()
Returns the relative path into the merge path. |
java.util.ArrayList<Path> |
getResources()
Returns all the resources matching the path. |
java.util.ArrayList<Path> |
getResources(java.lang.String pathName)
Returns all the resources matching the path. |
java.lang.String |
getScheme()
Returns the scheme of the best path. |
java.lang.String |
getURL()
Returns the URL of the best path. |
Path |
getWritePath()
Returns the first matching 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. |
Path |
schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String filePath,
int offset)
schemeWalk is called by Path for a scheme lookup like file:/tmp/foo |
java.lang.String |
toString()
Returns a name for the path |
| Methods inherited from class com.caucho.vfs.FilesystemPath |
|---|
bind, createRoot, equals, getParent, getPath, getRoot, getTail, getUserPath, hashCode, normalizePath, normalizePath, setUserPath |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MergePath()
| Method Detail |
|---|
public Path schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String filePath,
int offset)
schemeWalk in class FilesystemPathuserPath - the user's lookup() pathattributes - the user's attributesfilePath - the actual lookup() pathoffset - offset into filePath
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 void addResourceClassPath(java.lang.ClassLoader loader)
loader - class loader whose classpath should be used to search.public void addLocalClassPath()
public void addLocalClassPath(java.lang.ClassLoader loader)
loader - class loader whose classpath should be used to search.public void addClassPath(java.lang.String classpath)
classpath - class loader whose classpath should be used to search.public java.util.ArrayList<Path> getMergePaths()
public Path fsWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String path)
fsWalk in class FilesystemPathuserPath - the exact string passed by the user's lookup()attributes - the user's new attributespath - the normalized real path
public java.lang.String getScheme()
getScheme in class Pathpublic java.lang.String getFullPath()
getFullPath in class FilesystemPathpublic java.lang.String getNativePath()
getNativePath in class Pathpublic java.lang.String getURL()
getURL in class Pathpublic java.lang.String getRelativePath()
getRelativePath in class Pathpublic boolean exists()
exists in class Pathpublic boolean isDirectory()
isDirectory in class Pathpublic boolean isFile()
isFile in class Pathpublic long getLength()
getLength in class Pathpublic long getLastModified()
getLastModified in class Pathpublic boolean canRead()
canRead in class Pathpublic boolean canWrite()
canWrite in class Pathpublic java.util.ArrayList<Path> getResources(java.lang.String pathName)
getResources in class Pathpublic java.util.ArrayList<Path> getResources()
getResources in class Path
public java.lang.String[] list()
throws java.io.IOException
list in class Pathjava.io.IOException
public boolean mkdir()
throws java.io.IOException
mkdir in class Pathjava.io.IOException
public boolean mkdirs()
throws java.io.IOException
mkdirs in class Pathjava.io.IOException
public boolean remove()
throws java.io.IOException
remove in class Pathjava.io.IOException
public boolean renameTo(Path path)
throws java.io.IOException
renameTo in class Pathjava.io.IOException
public StreamImpl openReadImpl()
throws java.io.IOException
openReadImpl in class Pathjava.io.IOException
public StreamImpl openWriteImpl()
throws java.io.IOException
openWriteImpl in class Pathjava.io.IOException
public StreamImpl openReadWriteImpl()
throws java.io.IOException
openReadWriteImpl in class Pathjava.io.IOException
public StreamImpl openAppendImpl()
throws java.io.IOException
openAppendImpl in class Pathjava.io.IOExceptionpublic Path getWritePath()
public PersistentDependency createDepend()
createDepend in class Pathpublic Path getBestPath()
public java.lang.String toString()
toString in class Path
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||