|
||||||||||
| 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.PathWrapper
public abstract class PathWrapper
Wraps a path object.
| Field Summary | |
|---|---|
protected static L10N |
L
|
| Fields inherited from class com.caucho.vfs.Path |
|---|
_pathSeparatorChar, _schemeMap, _separatorChar |
| Constructor Summary | |
|---|---|
protected |
PathWrapper(Path path)
Creates a new Path object. |
| Method Summary | |
|---|---|
void |
bind(Path context)
Binds the context to the current path. |
boolean |
canRead()
Tests if the file can be read. |
boolean |
canWrite()
Tests if the file can be written. |
boolean |
changeGroup(int gid)
Changes the group |
boolean |
changeGroup(java.lang.String groupName)
Changes the group |
boolean |
changeOwner(int uid)
Changes the owner |
boolean |
changeOwner(java.lang.String ownerName)
Changes the owner |
boolean |
chmod(int value)
Changes the permissions |
boolean |
createNewFile()
Creates the file named by this Path and returns true if the file is new. |
Path |
createRoot()
Creates a restricted root, like the Unix chroot call. |
Path |
createRoot(SchemeMap schemeMap)
|
Path |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates a unique temporary file as a child of this directory. |
boolean |
equals(java.lang.Object o)
|
boolean |
exists()
Tests if the file exists. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets an attribute of the object. |
java.util.Iterator |
getAttributeNames()
Returns a iterator of all attribute names set for this object. |
java.lang.String |
getContentType()
Returns the mime-type of the file. |
long |
getCrc64()
Returns the crc64 code. |
long |
getCreateTime()
Returns the create time of the file. |
long |
getDiskSpaceFree()
|
long |
getDiskSpaceTotal()
|
java.lang.String |
getFullPath()
Returns the full path, including the restricted root. |
int |
getGroup()
Returns equivalent of struct stat.st_gid if appropriate. |
java.lang.String |
getHost()
Returns the hostname |
long |
getInode()
Returns equivalent of struct stat.st_ino if appropriate. |
long |
getLastAccessTime()
Returns the last access time of the file. |
long |
getLastModified()
Returns the last modified time of the file. |
long |
getLength()
Returns the length of the file in bytes. |
java.lang.String |
getNativePath()
Returns the native representation of the path. |
java.lang.Object |
getObject()
Returns the object at this path. |
int |
getOwner()
|
Path |
getParent()
Returns the parent path. |
java.lang.String |
getPath()
Returns the path. |
int |
getPort()
Returns the port. |
java.lang.String |
getQuery()
Returns the query string of the path. |
java.lang.String |
getRelativePath()
For union paths like MergePath, return the relative path into that path. |
java.util.ArrayList<Path> |
getResources()
Looks up all the existing resources. |
java.util.ArrayList<Path> |
getResources(java.lang.String name)
Looks up all the resources matching a name. |
java.lang.String |
getScheme()
Returns the url scheme |
java.lang.String |
getTail()
Returns the last segment of the path. |
java.lang.String |
getURL()
Returns the full url for the given path. |
java.lang.String |
getUserPath()
Returns the last string used as a lookup, if available. |
java.lang.Object |
getValue()
Gets the object at the path. |
Path |
getWrappedPath()
Returns the wrapped path. |
int |
hashCode()
|
boolean |
isDirectory()
Tests if the path refers to a directory. |
boolean |
isExecutable()
Tests if the path is marked as executable |
boolean |
isFile()
Tests if the path refers to a file. |
boolean |
isObject()
Tests if the path refers to an object. |
java.util.Iterator<java.lang.String> |
iterator()
Returns a jdk1.2 Iterator for the contents of this directory. |
java.lang.String[] |
list()
|
Path |
lookup(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes)
Returns a new path relative to the current one. |
Path |
lookupImpl(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes)
Returns a new path relative to the current one. |
Path |
lookupNative(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Looks up a native path, adding attributes. |
boolean |
mkdir()
Creates the directory named by this path. |
boolean |
mkdirs()
Creates the directory named by this path and any parent directories. |
WriteStream |
openAppend()
Opens a resin stream for appending. |
StreamImpl |
openAppendImpl()
|
RandomAccessStream |
openRandomAccess()
Opens a random-access stream. |
StreamImpl |
openReadImpl()
|
ReadWritePair |
openReadWrite()
Opens a resin ReadWritePair for reading and writing. |
void |
openReadWrite(ReadStream is,
WriteStream os)
Opens a resin ReadWritePair for reading and writing. |
StreamImpl |
openReadWriteImpl()
|
StreamImpl |
openWriteImpl()
|
boolean |
remove()
Removes the file or directory named by this path. |
boolean |
removeAll()
Removes the all files and directories below this path. |
boolean |
renameTo(Path path)
Renames the file or directory to the name given by the path. |
Path |
schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes,
java.lang.String newPath,
int offset)
Path-specific lookup. |
boolean |
setExecutable(boolean isExecutable)
Change the executable status of the of the path. |
void |
setLastModified(long time)
|
void |
setObject(java.lang.Object obj)
Sets the object at this path. |
void |
setUserPath(java.lang.String userPath)
Sets the user path. |
void |
setValue(java.lang.Object obj)
Sets the object at the path. |
java.lang.String |
toString()
|
void |
unbind()
unbinds a link. |
void |
writeToStream(java.io.OutputStream os)
Utility to write the contents of this path to the destination stream. |
void |
writeToStream(OutputStreamWithBuffer os)
Utility to write the contents of this path to the destination stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final L10N L
| Constructor Detail |
|---|
protected PathWrapper(Path path)
path - the new Path root.| Method Detail |
|---|
public Path getWrappedPath()
public Path lookup(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes)
Path only handles scheme:xxx. Subclasses of Path will specialize the xxx.
lookup in class PathuserPath - relative or absolute path, essentially any url.newAttributes - attributes for the new path.
public Path lookupImpl(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes)
Path only handles scheme:xxx. Subclasses of Path will specialize the xxx.
lookupImpl in class PathuserPath - relative or absolute path, essentially any url.newAttributes - attributes for the new path.
public Path lookupNative(java.lang.String name,
java.util.Map<java.lang.String,java.lang.Object> attributes)
lookupNative in class Pathpublic java.util.ArrayList<Path> getResources(java.lang.String name)
getResources in class Pathpublic java.util.ArrayList<Path> getResources()
getResources in class Pathpublic Path getParent()
getParent in class Path
public Path schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> newAttributes,
java.lang.String newPath,
int offset)
schemeWalk in class PathuserPath - the user's lookup() path.newAttributes - the attributes for the new path.newPath - the lookup() pathoffset - offset into newPath to start lookup.
public java.lang.String getURL()
getURL in class Pathpublic java.lang.String getScheme()
getScheme in class Pathpublic java.lang.String getHost()
getHost in class Pathpublic int getPort()
getPort in class Pathpublic java.lang.String getPath()
getPath in class Pathpublic java.lang.String getTail()
e.g. for http://www.caucho.com/products/index.html, getTail() returns 'index.html'
getTail in class Pathpublic java.lang.String getQuery()
getQuery in class Pathpublic java.lang.String getNativePath()
getNativePath in class Pathpublic java.lang.String getUserPath()
Path path = Pwd.lookup("/some/dir").lookup("../test.html");
System.out.println(path.getUserPath());
getUserPath in class Pathpublic void setUserPath(java.lang.String userPath)
setUserPath in class Pathpublic java.lang.String getFullPath()
For the following, path.getPath() returns '/file.html', while
path.getFullPath() returns '/chroot/file.html'.
Path chroot = Pwd.lookup("/chroot").createRoot();
Path path = chroot.lookup("/file.html");
getFullPath in class Pathpublic java.lang.String getRelativePath()
getRelativePath in class Pathpublic boolean exists()
exists in class Pathpublic java.lang.String getContentType()
Mime-type ignorant filesystems return 'application/octet-stream'
getContentType in class Pathpublic boolean isDirectory()
isDirectory in class Pathpublic boolean isFile()
isFile in class Pathpublic boolean isObject()
isObject in class Pathpublic long getLength()
getLength in class Pathpublic long getLastModified()
getLastModified in class Pathpublic void setLastModified(long time)
setLastModified in class Pathpublic long getLastAccessTime()
getLastAccessTime in class Pathpublic long getCreateTime()
getCreateTime in class Pathpublic boolean canRead()
canRead in class Pathpublic boolean canWrite()
canWrite in class Pathpublic boolean chmod(int value)
chmod in class Path
public java.lang.String[] list()
throws java.io.IOException
list in class Pathjava.io.IOException
public java.util.Iterator<java.lang.String> iterator()
throws java.io.IOException
iterator 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 removeAll()
throws java.io.IOException
removeAll in class Pathjava.io.IOException
public boolean renameTo(Path path)
throws java.io.IOException
renameTo in class Pathjava.io.IOExceptionpublic Path createRoot()
createRoot is useful for restricting JavaScript scripts without resorting to the dreadfully slow security manager.
createRoot in class Pathpublic Path createRoot(SchemeMap schemeMap)
createRoot in class Pathpublic void bind(Path context)
bind in class Pathpublic void unbind()
unbind in class Path
public java.lang.Object getValue()
throws java.lang.Exception
A bean filesystem or a mime-type aware filesystem could deserialize the contents of the file.
getValue in class Pathjava.lang.Exception
public void setValue(java.lang.Object obj)
throws java.lang.Exception
Normal filesystems will generally do nothing. However, a bean filesystem or a mime-type aware filesystem could serialize the object and store it.
setValue in class Pathjava.lang.Exception
public java.lang.Object getAttribute(java.lang.String name)
throws java.io.IOException
getAttribute in class Pathjava.io.IOException
public java.util.Iterator getAttributeNames()
throws java.io.IOException
getAttributeNames in class Pathjava.io.IOException
public ReadWritePair openReadWrite()
throws java.io.IOException
A chat channel, for example, would open its socket using this interface.
openReadWrite in class Pathjava.io.IOException
public void openReadWrite(ReadStream is,
WriteStream os)
throws java.io.IOException
A chat channel, for example, would open its socket using this interface.
openReadWrite in class Pathis - pre-allocated ReadStream to be initializedos - pre-allocated WriteStream to be initialized
java.io.IOException
public WriteStream openAppend()
throws java.io.IOException
openAppend in class Pathjava.io.IOException
public RandomAccessStream openRandomAccess()
throws java.io.IOException
openRandomAccess in class Pathjava.io.IOException
public boolean createNewFile()
throws java.io.IOException
createNewFile in class Pathjava.io.IOException
public Path createTempFile(java.lang.String prefix,
java.lang.String suffix)
throws java.io.IOException
createTempFile in class Pathprefix - filename prefixsuffix - filename suffix, defaults to .tmp
java.io.IOException
public void writeToStream(java.io.OutputStream os)
throws java.io.IOException
writeToStream in class Pathos - destination stream.
java.io.IOException
public void writeToStream(OutputStreamWithBuffer os)
throws java.io.IOException
writeToStream in class Pathos - destination stream.
java.io.IOExceptionpublic long getCrc64()
getCrc64 in class Path
public java.lang.Object getObject()
throws java.io.IOException
getObject in class Pathjava.io.IOException
public void setObject(java.lang.Object obj)
throws java.io.IOException
setObject in class Pathjava.io.IOExceptionpublic long getInode()
Path
getInode in class Pathpublic boolean isExecutable()
Path
isExecutable in class Pathpublic boolean setExecutable(boolean isExecutable)
Path
setExecutable in class Pathpublic int getGroup()
Path
getGroup in class Path
public boolean changeGroup(int gid)
throws java.io.IOException
Path
changeGroup in class Pathjava.io.IOException
public boolean changeGroup(java.lang.String groupName)
throws java.io.IOException
Path
changeGroup in class Pathjava.io.IOExceptionpublic int getOwner()
getOwner in class Path
public boolean changeOwner(int uid)
throws java.io.IOException
Path
changeOwner in class Pathjava.io.IOException
public boolean changeOwner(java.lang.String ownerName)
throws java.io.IOException
Path
changeOwner in class Pathjava.io.IOExceptionpublic long getDiskSpaceFree()
getDiskSpaceFree in class Pathpublic long getDiskSpaceTotal()
getDiskSpaceTotal in class Pathpublic int hashCode()
hashCode in class Pathpublic boolean equals(java.lang.Object o)
equals in class Pathpublic java.lang.String toString()
toString in class Path
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.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||