com.caucho.vfs
Class Path

java.lang.Object
  extended by com.caucho.vfs.Path
All Implemented Interfaces:
java.lang.Comparable<Path>
Direct Known Subclasses:
ConfigPath, ConstPath, DatastorePath, FilesystemPath, MailtoPath, NotFoundPath, NullPath, PathWrapper, RepositoryPath, StringPath, TcpPath

public abstract class Path
extends java.lang.Object
implements java.lang.Comparable<Path>

A virtual filesystem path, essentially represented by a URL. Its API resembles a combination of the JDK File object and the URL object.

Paths are, in general, given with the canonical file separator of forward slash, '/'. The filesystems will take care of any necessary translation.

Currently available filesystems:

file:/path/to/file
Java file
http://host:port/path/name?query
HTTP request
tcp://host:port
Raw TCP connection
mailto:user@host?subject=foo&cc=user2
Mail to a user.
log:/group/subgroup/item
Logging based on the configuration file.
stdout:
System.out
stderr:
System.err
null:
The equivalent of /dev/null


Field Summary
protected static char _pathSeparatorChar
           
protected  SchemeMap _schemeMap
           
protected static char _separatorChar
           
protected static L10N L
           
 
Constructor Summary
protected Path(Path root)
          Creates a new Path object.
protected Path(SchemeMap map)
          Creates a new Path object.
 
Method Summary
 void bind(Path context)
          Binds the context to the current path.
protected  Path cacheCopy()
          Copy for caching.
 boolean canExecute()
          Tests if the file can be read.
 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
 void clearStatusCache()
          Clears any status cache
 int compareTo(Path path)
           
 Path copy()
           
 PersistentDependency createDepend()
          Creates a dependency.
 boolean createLink(Path target, boolean hardLink)
          Creates a link named by this path to another path.
 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)
           
protected static java.lang.String escapeURL(java.lang.String rawURL)
           
 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.
 long getBlockCount()
          Returns equivalent of struct stat.st_blocks if appropriate.
 long getBlockSize()
          Returns equivalent of struct stat.st_blksize if appropriate.
protected  Path getCache(java.lang.String subPath)
           
 java.security.cert.Certificate[] getCertificates()
          Returns any signing certificates, e.g.
 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 getDevice()
          Returns equivalent of struct stat.st_dev if appropriate.
 long getDeviceId()
          Returns equivalent of struct stat.st_rdev if appropriate.
 long getDiskSpaceFree()
           
 long getDiskSpaceTotal()
           
static char getFileSeparatorChar()
           
 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 getLastStatusChangeTime()
          Returns equivalent of struct stat.st_ctime if appropriate.
 long getLength()
          Returns the length of the file in bytes.
 int getMode()
          Returns equivalent of struct stat.st_mode if appropriate.
 java.lang.String getNativePath()
          Returns the native representation of the path.
static java.lang.String getNewlineString()
           
 int getNumberOfLinks()
          Returns equivalent of struct stat.st_nlink if appropriate.
 java.lang.Object getObject()
          Returns the object at this path.
 int getOwner()
           
 Path getParent()
          Returns the parent path.
abstract  java.lang.String getPath()
          Returns the path.
static char getPathSeparatorChar()
           
 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.
abstract  java.lang.String getScheme()
          Returns the url scheme
 SchemeMap getSchemeMap()
          Returns the schemeMap
protected static char getSeparatorChar()
           
 java.lang.String getTail()
          Returns the last segment of the path.
 java.lang.String getURL()
          Returns the full url for the given path.
 int getUser()
          Returns equivalent of struct stat.st_uid if appropriate.
protected static java.lang.String getUserDir()
           
 java.lang.String getUserPath()
          Returns the last string used as a lookup, if available.
 java.lang.Object getValue()
          Gets the object at the path.
 int hashCode()
           
 boolean isBlockDevice()
          Tests if the path refers to a block device.
 boolean isCharacterDevice()
          Tests if the path refers to a block device.
 boolean isDirectory()
          Tests if the path refers to a directory.
 boolean isExecutable()
          Tests if the path is marked as executable
 boolean isFIFO()
          Tests if the path refers to a FIFO.
 boolean isFile()
          Tests if the path refers to a file.
 boolean isHardLink()
          Tests if the path refers to a hard link.
 boolean isLink()
          Tests if the path refers to a symbolic link.
 boolean isObject()
          Tests if the path refers to an object.
protected  boolean isPathCacheable()
          Returns true if the path itself is cacheable
 boolean isSocket()
          Tests if the path refers to a socket.
 boolean isSymbolicLink()
          Tests if the path refers to a symbolic link.
static boolean isWindows()
           
 boolean isWindowsInsecure()
          Returns true for windows security issues.
 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 name)
          Looks up a new path based on the old path.
 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 lookup(java.net.URL url)
          Looks up a path by a URL.
 Path lookupChild(java.lang.String name)
          Looks up a new path based on the old path.
 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)
          Looks up a path using the local filesystem conventions.
 Path lookupNative(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> attributes)
          Looks up a native path, adding attributes.
 java.lang.String lookupRelativeNativePath(Path path)
          Returns a native path relative to this native path if the passed path is relative to this path, or an absolute path if the passed path is not relative to this path.
 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 openFileRandomAccess()
          Opens a random-access stream.
 RandomAccessStream openMemoryMappedFile(long fileSize)
          Opens a random-access stream.
 RandomAccessStream openRandomAccess()
          Opens a random-access stream.
 ReadStream openRead()
          Opens a resin ReadStream for reading.
 StreamImpl openReadImpl()
           
 ReadWritePair openReadWrite()
          Opens a resin ReadWritePair for reading and writing.
 ReadWritePair openReadWrite(boolean isAutoFlush)
          Opens a resin ReadWritePair for reading and writing.
 void openReadWrite(ReadStream is, WriteStream os)
          Opens a resin ReadWritePair for reading and writing.
 StreamImpl openReadWriteImpl()
           
 WriteStream openWrite()
          Opens a resin WriteStream for writing.
 StreamImpl openWriteImpl()
           
protected  void putCache(java.lang.String subPath, Path path)
           
 java.lang.String readLink()
          Returns the target path from the link.
 java.lang.String realPath()
          Returns the actual path from the link.
 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.
 boolean renameTo(java.lang.String path)
          Renames the file or directory to the name given by the path.
protected  java.lang.String scanScheme(java.lang.String uri)
          Returns the scheme portion of a uri.
abstract  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.
 void sendfile(java.io.OutputStream os, long offset, long length)
          Utility to write the contents of this path to the destination stream.
static void setDefaultSchemeMap(SchemeMap schemeMap)
           
 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.
static void setTestWindows(boolean isTest)
           
 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()
           
 boolean truncate()
          Sets the length of the file to zero.
 boolean truncate(long length)
          Sets the length of the file.
 void unbind()
          unbinds a link.
 Path unwrap()
           
 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

L

protected static final L10N L

_separatorChar

protected static char _separatorChar

_pathSeparatorChar

protected static char _pathSeparatorChar

_schemeMap

protected SchemeMap _schemeMap
Constructor Detail

Path

protected Path(Path root)
Creates a new Path object.

Parameters:
root - the new Path root.

Path

protected Path(SchemeMap map)
Creates a new Path object.

Parameters:
root - the new Path root.
Method Detail

lookup

public final Path lookup(java.lang.String name)
Looks up a new path based on the old path.

Parameters:
name - relative url to the new path
Returns:
The new path.

lookupChild

public final Path lookupChild(java.lang.String name)
Looks up a new path based on the old path.

Parameters:
name - relative url to the new path
Returns:
The new path.

lookup

public final Path lookup(java.net.URL url)
Looks up a path by a URL.


lookup

public 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 only handles scheme:xxx. Subclasses of Path will specialize the xxx.

Parameters:
userPath - relative or absolute path, essentially any url.
newAttributes - attributes for the new path.
Returns:
the new path or null if the scheme doesn't exist

getCache

protected Path getCache(java.lang.String subPath)

putCache

protected void putCache(java.lang.String subPath,
                        Path path)

isPathCacheable

protected boolean isPathCacheable()
Returns true if the path itself is cacheable


lookupImpl

public 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 only handles scheme:xxx. Subclasses of Path will specialize the xxx.

Parameters:
userPath - relative or absolute path, essentially any url.
newAttributes - attributes for the new path.
Returns:
the new path or null if the scheme doesn't exist

lookupNative

public final Path lookupNative(java.lang.String name)
Looks up a path using the local filesystem conventions. e.g. on Windows, a name of 'd:\foo\bar\baz.html' will look up the baz.html on drive d.

Parameters:
name - relative url using local filesystem separators.

lookupNative

public Path lookupNative(java.lang.String name,
                         java.util.Map<java.lang.String,java.lang.Object> attributes)
Looks up a native path, adding attributes.


lookupRelativeNativePath

public java.lang.String lookupRelativeNativePath(Path path)
Returns a native path relative to this native path if the passed path is relative to this path, or an absolute path if the passed path is not relative to this path.


getResources

public java.util.ArrayList<Path> getResources(java.lang.String name)
Looks up all the resources matching a name. (Generally only useful with MergePath.


getResources

public java.util.ArrayList<Path> getResources()
Looks up all the existing resources. (Generally only useful with MergePath.


getParent

public Path getParent()
Returns the parent path.


scanScheme

protected java.lang.String scanScheme(java.lang.String uri)
Returns the scheme portion of a uri. Since schemes are case-insensitive, normalize them to lower case.


schemeWalk

public abstract 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. Path implementations will override this.

Parameters:
userPath - the user's lookup() path.
newAttributes - the attributes for the new path.
newPath - the lookup() path
offset - offset into newPath to start lookup.
Returns:
the found path

getURL

public java.lang.String getURL()
Returns the full url for the given path.


getScheme

public abstract java.lang.String getScheme()
Returns the url scheme


getSchemeMap

public SchemeMap getSchemeMap()
Returns the schemeMap


getHost

public java.lang.String getHost()
Returns the hostname


getPort

public int getPort()
Returns the port.


getPath

public abstract java.lang.String getPath()
Returns the path. e.g. for HTTP, returns the part after the host and port.


getTail

public java.lang.String getTail()
Returns the last segment of the path.

e.g. for http://www.caucho.com/products/index.html, getTail() returns 'index.html'


getQuery

public java.lang.String getQuery()
Returns the query string of the path.


getNativePath

public java.lang.String getNativePath()
Returns the native representation of the path. On Windows, getNativePath() returns 'd:\\foo\bar.html', getPath() returns '/d:/foo/bar.html'


getUserPath

public java.lang.String getUserPath()
Returns the last string used as a lookup, if available. This allows parsers to give intelligent error messages, with the user's path instead of the whole path. The following will print '../test.html':
 Path path = Pwd.lookup("/some/dir").lookup("../test.html");
 System.out.println(path.getUserPath());
 


setUserPath

public void setUserPath(java.lang.String userPath)
Sets the user path. Useful for temporary files caching another URL.


getFullPath

public java.lang.String getFullPath()
Returns the full path, including the restricted root.

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");
 


getRelativePath

public java.lang.String getRelativePath()
For union paths like MergePath, return the relative path into that path.


isWindowsInsecure

public boolean isWindowsInsecure()
Returns true for windows security issues.


getCertificates

public java.security.cert.Certificate[] getCertificates()
Returns any signing certificates, e.g. for jar signing.


exists

public boolean exists()
Tests if the file exists.


getContentType

public java.lang.String getContentType()
Returns the mime-type of the file.

Mime-type ignorant filesystems return 'application/octet-stream'


isDirectory

public boolean isDirectory()
Tests if the path refers to a directory.


isFile

public boolean isFile()
Tests if the path refers to a file.


isLink

public boolean isLink()
Tests if the path refers to a symbolic link.


isSocket

public boolean isSocket()
Tests if the path refers to a socket.


isFIFO

public boolean isFIFO()
Tests if the path refers to a FIFO.


isBlockDevice

public boolean isBlockDevice()
Tests if the path refers to a block device.


isCharacterDevice

public boolean isCharacterDevice()
Tests if the path refers to a block device.


isExecutable

public boolean isExecutable()
Tests if the path is marked as executable


setExecutable

public boolean setExecutable(boolean isExecutable)
Change the executable status of the of the path.

Throws:
java.lang.UnsupportedOperationException

isSymbolicLink

public boolean isSymbolicLink()
Tests if the path refers to a symbolic link.


isHardLink

public boolean isHardLink()
Tests if the path refers to a hard link.


isObject

public boolean isObject()
Tests if the path refers to an object.


clearStatusCache

public void clearStatusCache()
Clears any status cache


getLength

public long getLength()
Returns the length of the file in bytes.

Returns:
0 for non-files

getLastModified

public long getLastModified()
Returns the last modified time of the file. According to the jdk, this may not correspond to the system time.

Returns:
0 for non-files.

setLastModified

public void setLastModified(long time)

getLastAccessTime

public long getLastAccessTime()
Returns the last access time of the file.

Returns:
0 for non-files.

getCreateTime

public long getCreateTime()
Returns the create time of the file.

Returns:
0 for non-files.

canRead

public boolean canRead()
Tests if the file can be read.


canWrite

public boolean canWrite()
Tests if the file can be written.


getDevice

public long getDevice()
Returns equivalent of struct stat.st_dev if appropriate.


getInode

public long getInode()
Returns equivalent of struct stat.st_ino if appropriate.


getMode

public int getMode()
Returns equivalent of struct stat.st_mode if appropriate.


getNumberOfLinks

public int getNumberOfLinks()
Returns equivalent of struct stat.st_nlink if appropriate.


getUser

public int getUser()
Returns equivalent of struct stat.st_uid if appropriate.


getGroup

public int getGroup()
Returns equivalent of struct stat.st_gid if appropriate.


getDeviceId

public long getDeviceId()
Returns equivalent of struct stat.st_rdev if appropriate.


getBlockSize

public long getBlockSize()
Returns equivalent of struct stat.st_blksize if appropriate.


getBlockCount

public long getBlockCount()
Returns equivalent of struct stat.st_blocks if appropriate.


getLastStatusChangeTime

public long getLastStatusChangeTime()
Returns equivalent of struct stat.st_ctime if appropriate.


canExecute

public boolean canExecute()
Tests if the file can be read.


changeGroup

public boolean changeGroup(int gid)
                    throws java.io.IOException
Changes the group

Throws:
java.io.IOException

changeGroup

public boolean changeGroup(java.lang.String groupName)
                    throws java.io.IOException
Changes the group

Throws:
java.io.IOException

chmod

public boolean chmod(int value)
Changes the permissions

Returns:
true if successful

getOwner

public int getOwner()

changeOwner

public boolean changeOwner(int uid)
                    throws java.io.IOException
Changes the owner

Returns:
true if successful
Throws:
java.io.IOException

changeOwner

public boolean changeOwner(java.lang.String ownerName)
                    throws java.io.IOException
Changes the owner

Returns:
true if successful
Throws:
java.io.IOException

getDiskSpaceFree

public long getDiskSpaceFree()

getDiskSpaceTotal

public long getDiskSpaceTotal()

list

public java.lang.String[] list()
                        throws java.io.IOException
Returns:
The contents of this directory or null if the path does not refer to a directory.
Throws:
java.io.IOException

iterator

public java.util.Iterator<java.lang.String> iterator()
                                              throws java.io.IOException
Returns a jdk1.2 Iterator for the contents of this directory.

Throws:
java.io.IOException

mkdir

public boolean mkdir()
              throws java.io.IOException
Creates the directory named by this path.

Returns:
true if successful.
Throws:
java.io.IOException

mkdirs

public boolean mkdirs()
               throws java.io.IOException
Creates the directory named by this path and any parent directories.

Returns:
true if successful.
Throws:
java.io.IOException

remove

public boolean remove()
               throws java.io.IOException
Removes the file or directory named by this path.

Returns:
true if successful
Throws:
java.io.IOException

removeAll

public boolean removeAll()
                  throws java.io.IOException
Removes the all files and directories below this path.

Returns:
true if successful.
Throws:
java.io.IOException

truncate

public boolean truncate()
                 throws java.io.IOException
Sets the length of the file to zero.

Returns:
true if successful
Throws:
java.io.IOException

truncate

public boolean truncate(long length)
                 throws java.io.IOException
Sets the length of the file.

Returns:
true if successful
Throws:
java.io.IOException

renameTo

public boolean renameTo(Path path)
                 throws java.io.IOException
Renames the file or directory to the name given by the path.

Returns:
true if successful
Throws:
java.io.IOException

renameTo

public final boolean renameTo(java.lang.String path)
                       throws java.io.IOException
Renames the file or directory to the name given by the path.

Returns:
true if successful
Throws:
java.io.IOException

createRoot

public Path createRoot()
Creates a restricted root, like the Unix chroot call. Restricted roots cannot access schemes, so file:/etc/passwd cannot be used.

createRoot is useful for restricting JavaScript scripts without resorting to the dreadfully slow security manager.


createRoot

public Path createRoot(SchemeMap schemeMap)

bind

public void bind(Path context)
Binds the context to the current path. Later lookups will return the new context instead of the current path. Essentially, this is a software symbolic link.


unbind

public void unbind()
unbinds a link.


getValue

public java.lang.Object getValue()
                          throws java.lang.Exception
Gets the object at the path. Normal filesystems will generally typically return null.

A bean filesystem or a mime-type aware filesystem could deserialize the contents of the file.

Throws:
java.lang.Exception

setValue

public void setValue(java.lang.Object obj)
              throws java.lang.Exception
Sets the object at the path.

Normal filesystems will generally do nothing. However, a bean filesystem or a mime-type aware filesystem could serialize the object and store it.

Throws:
java.lang.Exception

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.io.IOException
Gets an attribute of the object.

Throws:
java.io.IOException

getAttributeNames

public java.util.Iterator getAttributeNames()
                                     throws java.io.IOException
Returns a iterator of all attribute names set for this object.

Returns:
null if path has no attributes.
Throws:
java.io.IOException

openRead

public final ReadStream openRead()
                          throws java.io.IOException
Opens a resin ReadStream for reading.

Throws:
java.io.IOException

openWrite

public final WriteStream openWrite()
                            throws java.io.IOException
Opens a resin WriteStream for writing.

Throws:
java.io.IOException

openReadWrite

public ReadWritePair openReadWrite()
                            throws java.io.IOException
Opens a resin ReadWritePair for reading and writing.

A chat channel, for example, would open its socket using this interface.

Throws:
java.io.IOException

openReadWrite

public ReadWritePair openReadWrite(boolean isAutoFlush)
                            throws java.io.IOException
Opens a resin ReadWritePair for reading and writing.

A chat channel, for example, would open its socket using this interface.

Throws:
java.io.IOException

openReadWrite

public void openReadWrite(ReadStream is,
                          WriteStream os)
                   throws java.io.IOException
Opens a resin ReadWritePair for reading and writing.

A chat channel, for example, would open its socket using this interface.

Parameters:
is - pre-allocated ReadStream to be initialized
os - pre-allocated WriteStream to be initialized
Throws:
java.io.IOException

openAppend

public WriteStream openAppend()
                       throws java.io.IOException
Opens a resin stream for appending.

Throws:
java.io.IOException

openMemoryMappedFile

public RandomAccessStream openMemoryMappedFile(long fileSize)
                                        throws java.io.IOException
Opens a random-access stream.

Throws:
java.io.IOException

openRandomAccess

public RandomAccessStream openRandomAccess()
                                    throws java.io.IOException
Opens a random-access stream.

Throws:
java.io.IOException

openFileRandomAccess

public RandomAccessStream openFileRandomAccess()
                                        throws java.io.IOException
Opens a random-access stream.

Throws:
java.io.IOException

createNewFile

public boolean createNewFile()
                      throws java.io.IOException
Creates the file named by this Path and returns true if the file is new.

Throws:
java.io.IOException

createDepend

public PersistentDependency createDepend()
Creates a dependency.


createTempFile

public Path createTempFile(java.lang.String prefix,
                           java.lang.String suffix)
                    throws java.io.IOException
Creates a unique temporary file as a child of this directory.

Parameters:
prefix - filename prefix
suffix - filename suffix, defaults to .tmp
Returns:
Path to the new file.
Throws:
java.io.IOException

createLink

public boolean createLink(Path target,
                          boolean hardLink)
                   throws java.io.IOException
Creates a link named by this path to another path.

Parameters:
target - the target of the link
hardLink - true if the link should be a hard link
Throws:
java.io.IOException

readLink

public java.lang.String readLink()
Returns the target path from the link. Returns null for a non-link.


realPath

public java.lang.String realPath()
Returns the actual path from the link.


writeToStream

public void writeToStream(java.io.OutputStream os)
                   throws java.io.IOException
Utility to write the contents of this path to the destination stream.

Parameters:
os - destination stream.
Throws:
java.io.IOException

writeToStream

public void writeToStream(OutputStreamWithBuffer os)
                   throws java.io.IOException
Utility to write the contents of this path to the destination stream.

Parameters:
os - destination stream.
Throws:
java.io.IOException

sendfile

public void sendfile(java.io.OutputStream os,
                     long offset,
                     long length)
              throws java.io.IOException
Utility to write the contents of this path to the destination stream.

Parameters:
os - destination stream.
Throws:
java.io.IOException

getCrc64

public long getCrc64()
Returns the crc64 code.


getObject

public java.lang.Object getObject()
                           throws java.io.IOException
Returns the object at this path. Normally, only paths like JNDI will support this.

Throws:
java.io.IOException

setObject

public void setObject(java.lang.Object obj)
               throws java.io.IOException
Sets the object at this path. Normally, only paths like JNDI will support this.

Throws:
java.io.IOException

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

openReadImpl

public StreamImpl openReadImpl()
                        throws java.io.IOException
Throws:
java.io.IOException

openWriteImpl

public StreamImpl openWriteImpl()
                         throws java.io.IOException
Throws:
java.io.IOException

openReadWriteImpl

public StreamImpl openReadWriteImpl()
                             throws java.io.IOException
Throws:
java.io.IOException

openAppendImpl

public StreamImpl openAppendImpl()
                          throws java.io.IOException
Throws:
java.io.IOException

escapeURL

protected static java.lang.String escapeURL(java.lang.String rawURL)

copy

public Path copy()

unwrap

public Path unwrap()

cacheCopy

protected Path cacheCopy()
Copy for caching.


compareTo

public int compareTo(Path path)
Specified by:
compareTo in interface java.lang.Comparable<Path>

setDefaultSchemeMap

public static final void setDefaultSchemeMap(SchemeMap schemeMap)

isWindows

public static final boolean isWindows()

setTestWindows

public static final void setTestWindows(boolean isTest)

getSeparatorChar

protected static final char getSeparatorChar()

getFileSeparatorChar

public static final char getFileSeparatorChar()

getPathSeparatorChar

public static final char getPathSeparatorChar()

getUserDir

protected static java.lang.String getUserDir()

getNewlineString

public static java.lang.String getNewlineString()