com.caucho.vfs
Class MemoryPath

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

public class MemoryPath
extends FilesystemPath


Nested Class Summary
 class MemoryPath.MemoryStream
           
 
Field Summary
 
Fields inherited from class com.caucho.vfs.FilesystemPath
_bindRoot, _pathname, _root, _userPath
 
Fields inherited from class com.caucho.vfs.Path
_pathSeparatorChar, _schemeMap, _separatorChar
 
Constructor Summary
  MemoryPath()
           
protected MemoryPath(FilesystemPath root, java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
           
 
Method Summary
 boolean canRead()
          Tests if the file can be read.
 boolean canWrite()
          Tests if the file can be written.
 Path copyCache()
           
 MemoryPath copyDeep()
           
 boolean equals(java.lang.Object o)
           
 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 a path relative to the current filesystem's root.
 long getLastModified()
          Returns the last modified time of the file.
 long getLength()
          Returns the length of the file in bytes.
 java.lang.String getScheme()
          Returns the url scheme
 java.lang.String getURL()
          Returns the full url for the given path.
 java.lang.Object getValue()
          Gets the object at the path.
 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.
 boolean isPathCacheable()
          Returns true if the path itself is cacheable
 java.lang.String[] list()
           
 boolean mkdir()
          Creates the directory named by this path.
 boolean mkdirs()
          Creates the directory named by this path and any parent directories.
 StreamImpl openAppendImpl()
           
 StreamImpl openReadImpl()
           
 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.
 boolean setExecutable(boolean isExecutable)
          Change the executable status of the of the path.
 void setValue(java.lang.Object object)
          Sets the object at the path.
 
Methods inherited from class com.caucho.vfs.FilesystemPath
bind, createRoot, getFullPath, getParent, getPath, getRoot, getTail, getUserPath, hashCode, normalizePath, normalizePath, schemeWalk, setUserPath
 
Methods inherited from class com.caucho.vfs.Path
cacheCopy, canExecute, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, copy, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getCertificates, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getDiskSpaceFree, getDiskSpaceTotal, getFileSeparatorChar, getGroup, getHost, getInode, getLastAccessTime, getLastStatusChangeTime, getMode, getNativePath, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUser, getUserDir, isBlockDevice, isCharacterDevice, isFIFO, isHardLink, isLink, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, lookup, lookup, lookup, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, openAppend, openFileRandomAccess, openMemoryMappedFile, openRandomAccess, openRead, openReadWrite, openReadWrite, openReadWrite, openReadWriteImpl, openWrite, putCache, readLink, realPath, removeAll, renameTo, scanScheme, setDefaultSchemeMap, setLastModified, setObject, setTestWindows, toString, truncate, truncate, unbind, writeToStream, writeToStream
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryPath

protected MemoryPath(FilesystemPath root,
                     java.lang.String userPath,
                     java.util.Map<java.lang.String,java.lang.Object> attributes,
                     java.lang.String path)

MemoryPath

public MemoryPath()
Method Detail

fsWalk

public Path fsWalk(java.lang.String userPath,
                   java.util.Map<java.lang.String,java.lang.Object> attributes,
                   java.lang.String path)
Description copied from class: FilesystemPath
Lookup a path relative to the current filesystem's root. Filesystems will specialize fsWalk.

Specified by:
fsWalk in class FilesystemPath
Parameters:
userPath - the exact string passed by the user's lookup()
attributes - the user's new attributes
path - the normalized real path
Returns:
the matching 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()
Description copied from class: Path
Returns the full url for the given path.

Overrides:
getURL in class Path

isPathCacheable

public boolean isPathCacheable()
Description copied from class: Path
Returns true if the path itself is cacheable

Overrides:
isPathCacheable in class Path

exists

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

Overrides:
exists 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

isObject

public boolean isObject()
Description copied from class: Path
Tests if the path refers to an object.

Overrides:
isObject in class Path

setExecutable

public boolean setExecutable(boolean isExecutable)
Description copied from class: Path
Change the executable status of the of the path.

Overrides:
setExecutable in class Path

isExecutable

public boolean isExecutable()
Description copied from class: Path
Tests if the path is marked as executable

Overrides:
isExecutable 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.

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()
Overrides:
list in class Path
Returns:
The contents of this directory or null if the path does not refer to a directory.

mkdir

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

Overrides:
mkdir in class Path
Returns:
true if successful.

mkdirs

public boolean mkdirs()
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.

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

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
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

getValue

public java.lang.Object getValue()
                          throws java.io.IOException
Description copied from class: Path
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.

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

setValue

public void setValue(java.lang.Object object)
              throws java.io.IOException
Description copied from class: Path
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.

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

copyCache

public Path copyCache()

copyDeep

public MemoryPath copyDeep()

equals

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