com.caucho.vfs
Class FilePath

java.lang.Object
  extended by com.caucho.vfs.Path
      extended by com.caucho.vfs.FilesystemPath
          extended by com.caucho.vfs.FilePath
All Implemented Interfaces:
java.lang.Comparable<Path>
Direct Known Subclasses:
JniFilePathImpl

public class FilePath
extends FilesystemPath

FilePath implements the native filesystem.


Field Summary
protected  boolean _isWindows
           
 
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
protected FilePath(FilesystemPath root, java.lang.String userPath, java.lang.String path)
           
  FilePath(java.lang.String path)
           
 
Method Summary
 boolean canRead()
          Tests if the file can be read.
 boolean canWrite()
          Tests if the file can be written.
protected  Path copy()
           
 boolean equals(java.lang.Object b)
           
 boolean exists()
          Tests if the file exists.
 Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
          Lookup the actual path relative to the filesystem root.
 long getDiskSpaceFree()
           
 long getDiskSpaceTotal()
           
 java.io.File getFile()
          Lazily returns the native File object.
 long getLastModified()
          Returns the last modified time of the file.
 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 path.
static java.lang.String getPwd()
          Gets the system's user dir (pwd) and convert it to the Resin format.
 java.lang.String getScheme()
          Returns the url scheme
 java.lang.String getURL()
          Returns the full url for the given path.
 int hashCode()
           
protected static java.lang.String initialPath(java.lang.String path)
           
protected  boolean isAux()
          Special case for the evil windows special
 boolean isDirectory()
          Tests if the path refers to a directory.
 boolean isFile()
          Tests if the path refers to a file.
protected  boolean isPathCacheable()
          Returns true if the path itself is cacheable
 java.lang.String[] list()
          Returns a list of files in the directory.
 boolean mkdir()
          Creates the directory named by this path.
 boolean mkdirs()
          Creates the directory named by this path and any parent directories.
 StreamImpl openAppendImpl()
           
 RandomAccessStream openFileRandomAccess()
          Returns the stream implementation for a random-access stream.
 StreamImpl openReadImpl()
          Returns the stream implementation for a read stream.
 StreamImpl openReadWriteImpl()
           
 StreamImpl openWriteImpl()
           
 boolean remove()
          Removes the file or directory named by 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> attributes, java.lang.String filePath, int offset)
          Lookup the path, handling windows weirdness
 void setLastModified(long time)
           
 boolean truncate(long length)
          Sets the length of the file.
 
Methods inherited from class com.caucho.vfs.FilesystemPath
bind, createRoot, getFullPath, getParent, getPath, getRoot, getTail, getUserPath, normalizePath, normalizePath, setUserPath
 
Methods inherited from class com.caucho.vfs.Path
cacheCopy, canExecute, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getCertificates, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getFileSeparatorChar, getGroup, getHost, getInode, getLastAccessTime, getLastStatusChangeTime, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUser, getUserDir, getValue, isBlockDevice, isCharacterDevice, isExecutable, isFIFO, isHardLink, isLink, isObject, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, lookup, lookup, lookup, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, openAppend, openMemoryMappedFile, openRandomAccess, openRead, openReadWrite, openReadWrite, openReadWrite, openWrite, putCache, readLink, realPath, removeAll, renameTo, scanScheme, setDefaultSchemeMap, setExecutable, setObject, setTestWindows, setValue, toString, truncate, unbind, writeToStream, writeToStream
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_isWindows

protected boolean _isWindows
Constructor Detail

FilePath

protected FilePath(FilesystemPath root,
                   java.lang.String userPath,
                   java.lang.String path)
Parameters:
path - canonical path

FilePath

public FilePath(java.lang.String path)
Method Detail

initialPath

protected static java.lang.String initialPath(java.lang.String path)

getPwd

public static java.lang.String getPwd()
Gets the system's user dir (pwd) and convert it to the Resin format.


getDiskSpaceFree

public long getDiskSpaceFree()
Overrides:
getDiskSpaceFree in class Path

getDiskSpaceTotal

public long getDiskSpaceTotal()
Overrides:
getDiskSpaceTotal in class Path

schemeWalk

public Path schemeWalk(java.lang.String userPath,
                       java.util.Map<java.lang.String,java.lang.Object> attributes,
                       java.lang.String filePath,
                       int offset)
Lookup the path, handling windows weirdness

Overrides:
schemeWalk in class FilesystemPath
Parameters:
userPath - the user's lookup() path
attributes - the user's attributes
filePath - the actual lookup() path
offset - offset into filePath
Returns:
the found path

fsWalk

public Path fsWalk(java.lang.String userPath,
                   java.util.Map<java.lang.String,java.lang.Object> attributes,
                   java.lang.String path)
Lookup the actual path relative to the filesystem root.

Specified by:
fsWalk in class FilesystemPath
Parameters:
userPath - the user's path to lookup()
attributes - the user's attributes to lookup()
path - the normalized path
Returns:
the selected path

isPathCacheable

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

Overrides:
isPathCacheable in class Path

getScheme

public java.lang.String getScheme()
Description copied from class: Path
Returns the url scheme

Specified by:
getScheme in class Path

getURL

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

Overrides:
getURL in class Path

getNativePath

public java.lang.String getNativePath()
Returns the native path.

Overrides:
getNativePath in class Path

exists

public boolean exists()
Description copied from class: Path
Tests if the file exists.

Overrides:
exists in class Path

getMode

public int getMode()
Description copied from class: Path
Returns equivalent of struct stat.st_mode if appropriate.

Overrides:
getMode in class Path

isDirectory

public boolean isDirectory()
Description copied from class: Path
Tests if the path refers to a directory.

Overrides:
isDirectory in class Path

isFile

public boolean isFile()
Description copied from class: Path
Tests if the path refers to a file.

Overrides:
isFile in class Path

getLength

public long getLength()
Description copied from class: Path
Returns the length of the file in bytes.

Overrides:
getLength in class Path
Returns:
0 for non-files

getLastModified

public long getLastModified()
Description copied from class: Path
Returns the last modified time of the file. According to the jdk, this may not correspond to the system time.

Overrides:
getLastModified in class Path
Returns:
0 for non-files.

setLastModified

public void setLastModified(long time)
Overrides:
setLastModified in class Path

canRead

public boolean canRead()
Description copied from class: Path
Tests if the file can be read.

Overrides:
canRead in class Path

canWrite

public boolean canWrite()
Description copied from class: Path
Tests if the file can be written.

Overrides:
canWrite in class Path

list

public java.lang.String[] list()
                        throws java.io.IOException
Returns a list of files in the directory.

Overrides:
list in class Path
Returns:
The contents of this directory or null if the path does not refer to a directory.
Throws:
java.io.IOException

mkdir

public boolean mkdir()
              throws java.io.IOException
Description copied from class: Path
Creates the directory named by this path.

Overrides:
mkdir in class Path
Returns:
true if successful.
Throws:
java.io.IOException

mkdirs

public boolean mkdirs()
               throws java.io.IOException
Description copied from class: Path
Creates the directory named by this path and any parent directories.

Overrides:
mkdirs in class Path
Returns:
true if successful.
Throws:
java.io.IOException

remove

public boolean remove()
Description copied from class: Path
Removes the file or directory named by this path.

Overrides:
remove in class Path
Returns:
true if successful

truncate

public boolean truncate(long length)
                 throws java.io.IOException
Description copied from class: Path
Sets the length of the file.

Overrides:
truncate in class Path
Returns:
true if successful
Throws:
java.io.IOException

renameTo

public boolean renameTo(Path path)
Description copied from class: Path
Renames the file or directory to the name given by the path.

Overrides:
renameTo in class Path
Returns:
true if successful

openReadImpl

public StreamImpl openReadImpl()
                        throws java.io.IOException
Returns the stream implementation for a read stream.

Overrides:
openReadImpl in class Path
Throws:
java.io.IOException

openWriteImpl

public StreamImpl openWriteImpl()
                         throws java.io.IOException
Overrides:
openWriteImpl in class Path
Throws:
java.io.IOException

openAppendImpl

public StreamImpl openAppendImpl()
                          throws java.io.IOException
Overrides:
openAppendImpl in class Path
Throws:
java.io.IOException

openReadWriteImpl

public StreamImpl openReadWriteImpl()
                             throws java.io.IOException
Overrides:
openReadWriteImpl in class Path
Throws:
java.io.IOException

openFileRandomAccess

public RandomAccessStream openFileRandomAccess()
                                        throws java.io.IOException
Returns the stream implementation for a random-access stream.

Overrides:
openFileRandomAccess in class Path
Throws:
java.io.IOException

copy

protected Path copy()
Overrides:
copy in class Path

hashCode

public int hashCode()
Overrides:
hashCode in class FilesystemPath

equals

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

getFile

public java.io.File getFile()
Lazily returns the native File object.


isAux

protected boolean isAux()
Special case for the evil windows special