Path.FileChannelFactory| Modifier and Type | Field and Description |
|---|---|
protected static L10N |
L |
_pathSeparatorChar, _schemeMap, _separatorChar| Modifier | Constructor and Description |
|---|---|
protected |
PathWrapper(Path path)
Creates a new Path object.
|
| Modifier and Type | Method and Description |
|---|---|
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,
boolean isAllowRoot)
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.
|
cacheCopy, canExecute, clearStatusCache, compareTo, copy, createDepend, createLink, escapeURL, fileChannelFactory, getBlockCount, getBlockSize, getCache, getCertificates, getDevice, getDeviceId, getFileSeparatorChar, getLastStatusChangeTime, getMode, getNewlineString, getNumberOfLinks, getPathSeparatorChar, getSchemeMap, getSeparatorChar, getUser, getUserDir, isBlockDevice, isCharacterDevice, isFIFO, isHardLink, isLink, isPathCacheable, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, lookup, lookup, lookupChild, lookupNative, lookupRelativeNativePath, openFileRandomAccess, openMemoryMappedFile, openRead, openReadWrite, openWrite, putCache, readLink, realPath, renameTo, scanScheme, sendfile, setDefaultSchemeMap, setTestWindows, truncate, truncate, unwrapprotected static final L10N L
protected PathWrapper(Path path)
path - the new Path root.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.
public Path lookupImpl(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> newAttributes, boolean isAllowRoot)
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 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()
public java.lang.String getScheme()
public java.lang.String getPath()
public java.lang.String getTail()
e.g. for http://www.caucho.com/products/index.html, getTail() returns 'index.html'
public java.lang.String getQuery()
public 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 java.lang.String getContentType()
Mime-type ignorant filesystems return 'application/octet-stream'
getContentType in class Pathpublic boolean isDirectory()
isDirectory in class Pathpublic boolean isObject()
public long getLength()
public 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 canWrite()
public boolean chmod(int value)
public java.lang.String[] list()
throws java.io.IOException
public java.util.Iterator<java.lang.String> iterator()
throws java.io.IOException
public boolean mkdir()
throws java.io.IOException
public boolean mkdirs()
throws java.io.IOException
public boolean remove()
throws java.io.IOException
public boolean removeAll()
throws java.io.IOException
public boolean renameTo(Path path) throws java.io.IOException
public 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)
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.
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.
public java.lang.Object getAttribute(java.lang.String name)
throws java.io.IOException
getAttribute in class Pathjava.io.IOExceptionpublic java.util.Iterator getAttributeNames()
throws java.io.IOException
getAttributeNames in class Pathjava.io.IOExceptionpublic ReadWritePair openReadWrite() throws java.io.IOException
A chat channel, for example, would open its socket using this interface.
openReadWrite in class Pathjava.io.IOExceptionpublic 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 initializedjava.io.IOExceptionpublic WriteStream openAppend() throws java.io.IOException
openAppend in class Pathjava.io.IOExceptionpublic RandomAccessStream openRandomAccess() throws java.io.IOException
openRandomAccess in class Pathjava.io.IOExceptionpublic boolean createNewFile()
throws java.io.IOException
createNewFile in class Pathjava.io.IOExceptionpublic Path createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
createTempFile in class Pathprefix - filename prefixsuffix - filename suffix, defaults to .tmpjava.io.IOExceptionpublic void writeToStream(java.io.OutputStream os)
throws java.io.IOException
writeToStream in class Pathos - destination stream.java.io.IOExceptionpublic void writeToStream(OutputStreamWithBuffer os) throws java.io.IOException
writeToStream in class Pathos - destination stream.java.io.IOExceptionpublic java.lang.Object getObject()
throws java.io.IOException
public void setObject(java.lang.Object obj)
throws java.io.IOException
public long getInode()
Pathpublic boolean isExecutable()
PathisExecutable in class Pathpublic boolean setExecutable(boolean isExecutable)
PathsetExecutable in class Pathpublic int getGroup()
Pathpublic boolean changeGroup(int gid)
throws java.io.IOException
PathchangeGroup in class Pathjava.io.IOExceptionpublic boolean changeGroup(java.lang.String groupName)
throws java.io.IOException
PathchangeGroup in class Pathjava.io.IOExceptionpublic boolean changeOwner(int uid)
throws java.io.IOException
PathchangeOwner in class Pathjava.io.IOExceptionpublic boolean changeOwner(java.lang.String ownerName)
throws java.io.IOException
PathchangeOwner in class Pathjava.io.IOExceptionpublic long getDiskSpaceFree()
getDiskSpaceFree in class Pathpublic long getDiskSpaceTotal()
getDiskSpaceTotal in class Pathpublic StreamImpl openReadImpl() throws java.io.IOException
openReadImpl in class Pathjava.io.IOExceptionpublic StreamImpl openWriteImpl() throws java.io.IOException
openWriteImpl in class Pathjava.io.IOExceptionpublic StreamImpl openReadWriteImpl() throws java.io.IOException
openReadWriteImpl in class Pathjava.io.IOExceptionpublic StreamImpl openAppendImpl() throws java.io.IOException
openAppendImpl in class Pathjava.io.IOException