com.caucho.vfs
Class JniFilePathImpl

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

public class JniFilePathImpl
extends FilePath

FilePath implements the native filesystem.


Field Summary
 
Fields inherited from class com.caucho.vfs.FilePath
_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
  JniFilePathImpl()
           
protected JniFilePathImpl(FilesystemPath root, java.lang.String userPath, java.lang.String path)
           
 
Method Summary
 boolean canRead()
          Returns true if the file can be read.
 boolean changeOwner(java.lang.String owner)
          Sets the file mode.
 boolean chmod(int mode)
          Sets the file mode.
 void clearStatusCache()
          Clears any status cache
protected  Path copy()
           
 boolean createLink(Path target, boolean hardLink)
          Creates a link named by this path to another path.
 boolean exists()
          Returns true 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 getBlockCount()
          Returns equivalent of struct stat.st_blocks if appropriate.
 long getBlockSize()
          Returns equivalent of struct stat.st_blksize if appropriate.
 long getCrc64()
          Returns the crc64 code.
 long getDevice()
          Returns equivalent of struct stat.st_dev if appropriate.
 long getDeviceId()
          Returns equivalent of struct stat.st_rdev if appropriate.
 int getGroup()
          Returns equivalent of struct stat.st_gid if appropriate.
static java.lang.String getInitMessage()
           
 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.
 long getLastStatusChangeTime()
          Returns equivalent of struct stat.st_ctime if appropriate.
 long getLength()
          Returns the length modified time.
 int getMode()
          Returns equivalent of struct stat.st_mode if appropriate.
 int getNumberOfLinks()
          Returns equivalent of struct stat.st_nlink if appropriate.
 int getUser()
          Returns equivalent of struct stat.st_uid if appropriate.
 boolean isBlockDevice()
          Tests if the path refers to a block device.
 boolean isCharacterDevice()
          Tests if the path refers to a block device.
 boolean isDirectory()
          Returns true if the file is a directory.
static boolean isEnabled()
          Returns true if the JNI file path exists.
 boolean isFIFO()
          Tests if the path refers to a FIFO.
 boolean isFile()
          Returns true if the file is a regular file.
 boolean isLink()
          Returns true if the file is a symbolic link.
protected  boolean isPathCacheable()
          Returns true if the path itself is cacheable
 boolean isSocket()
          Tests if the path refers to a socket.
 StreamImpl openAppendImpl()
          Returns the stream implementation for an append stream.
 RandomAccessStream openMemoryMappedFile(long fileLength)
          Opens a random-access stream.
 RandomAccessStream openRandomAccess()
          Returns the stream implementation for a random-access stream.
 StreamImpl openReadImpl()
          Returns the stream implementation for a read stream.
 StreamImpl openWriteImpl()
          Returns the stream implementation for a write stream.
 java.lang.String readLink()
          Returns the pathname of a link
 java.lang.String realPath()
          Returns the pathname of a link
 boolean remove()
          Remove the underlying file.
 boolean truncate(long length)
          Truncate the file.
 
Methods inherited from class com.caucho.vfs.FilePath
canWrite, equals, getDiskSpaceFree, getDiskSpaceTotal, getFile, getNativePath, getPwd, getScheme, getURL, hashCode, initialPath, isAux, list, mkdir, mkdirs, openFileRandomAccess, openReadWriteImpl, renameTo, schemeWalk, setLastModified
 
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, compareTo, createDepend, createNewFile, createRoot, createTempFile, escapeURL, getAttribute, getAttributeNames, getCache, getCertificates, getContentType, getCreateTime, getFileSeparatorChar, getHost, getNewlineString, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUserDir, getValue, isExecutable, isHardLink, isObject, isSymbolicLink, isWindows, isWindowsInsecure, iterator, lookup, lookup, lookup, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, openAppend, openRead, openReadWrite, openReadWrite, openReadWrite, openWrite, putCache, 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
 

Constructor Detail

JniFilePathImpl

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

JniFilePathImpl

public JniFilePathImpl()
Method Detail

isEnabled

public static boolean isEnabled()
Returns true if the JNI file path exists.


getInitMessage

public static java.lang.String getInitMessage()

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.

Overrides:
fsWalk in class FilePath
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 FilePath

exists

public boolean exists()
Returns true if the file exists.

Overrides:
exists in class FilePath

getLastAccessTime

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

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

getLastModified

public long getLastModified()
Returns the last modified time.

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

getLastStatusChangeTime

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

Overrides:
getLastStatusChangeTime in class Path

getLength

public long getLength()
Returns the length modified time.

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

chmod

public boolean chmod(int mode)
Sets the file mode.

Overrides:
chmod in class Path
Returns:
true if successful

changeOwner

public boolean changeOwner(java.lang.String owner)
Sets the file mode.

Overrides:
changeOwner in class Path
Returns:
true if successful

canRead

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

Overrides:
canRead in class FilePath

isDirectory

public boolean isDirectory()
Returns true if the file is a directory.

Overrides:
isDirectory in class FilePath

isFile

public boolean isFile()
Returns true if the file is a regular file.

Overrides:
isFile in class FilePath

isLink

public boolean isLink()
Returns true if the file is a symbolic link.

Overrides:
isLink in class Path

isSocket

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

Overrides:
isSocket in class Path

isFIFO

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

Overrides:
isFIFO in class Path

isBlockDevice

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

Overrides:
isBlockDevice in class Path

isCharacterDevice

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

Overrides:
isCharacterDevice in class Path

getCrc64

public long getCrc64()
Returns the crc64 code.

Overrides:
getCrc64 in class Path

remove

public boolean remove()
Remove the underlying file.

Overrides:
remove in class FilePath
Returns:
true if successful

truncate

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

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

openReadImpl

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

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

openWriteImpl

public StreamImpl openWriteImpl()
                         throws java.io.IOException
Returns the stream implementation for a write stream.

Overrides:
openWriteImpl in class FilePath
Throws:
java.io.IOException

openAppendImpl

public StreamImpl openAppendImpl()
                          throws java.io.IOException
Returns the stream implementation for an append stream.

Overrides:
openAppendImpl in class FilePath
Throws:
java.io.IOException

openMemoryMappedFile

public RandomAccessStream openMemoryMappedFile(long fileLength)
                                        throws java.io.IOException
Description copied from class: Path
Opens a random-access stream.

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

openRandomAccess

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

Overrides:
openRandomAccess in class Path
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.

Overrides:
createLink in class 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 pathname of a link

Overrides:
readLink in class Path

realPath

public java.lang.String realPath()
Returns the pathname of a link

Overrides:
realPath in class Path

getDevice

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

Overrides:
getDevice in class Path

getInode

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

Overrides:
getInode in class Path

getMode

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

Overrides:
getMode in class FilePath

getNumberOfLinks

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

Overrides:
getNumberOfLinks in class Path

getUser

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

Overrides:
getUser in class Path

getGroup

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

Overrides:
getGroup in class Path

getDeviceId

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

Overrides:
getDeviceId in class Path

getBlockSize

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

Overrides:
getBlockSize in class Path

getBlockCount

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

Overrides:
getBlockCount in class Path

clearStatusCache

public void clearStatusCache()
Description copied from class: Path
Clears any status cache

Overrides:
clearStatusCache in class Path

copy

protected Path copy()
Overrides:
copy in class FilePath