com.caucho.vfs
Class MemoryPath

java.lang.Object
  |
  +--com.caucho.vfs.Path
        |
        +--com.caucho.vfs.FilesystemPath
              |
              +--com.caucho.vfs.MemoryPath

public class MemoryPath
extends FilesystemPath


Inner Class Summary
 class MemoryPath.MemoryStream
           
 
Fields inherited from class com.caucho.vfs.FilesystemPath
bindRoot, pathname, root, separatorChar, userPath
 
Fields inherited from class com.caucho.vfs.Path
L, schemeMap
 
Constructor Summary
  MemoryPath()
           
protected MemoryPath(FilesystemPath root, java.lang.String userPath, java.util.Map 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.
 MemoryPath copyDeep()
           
 boolean exists()
          Tests if the file exists.
 Path fsWalk(java.lang.String userPath, java.util.Map 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.Object getValue()
          Gets the object at the path.
 boolean isDirectory()
          Tests if the path refers to a directory.
 boolean isFile()
          Tests if the path refers to a file.
 boolean isObject()
          Tests if the path refers to an object.
 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.
protected  StreamImpl openAppendImpl()
           
protected  StreamImpl openReadImpl()
           
protected  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.
 void setValue(java.lang.Object object)
          Sets the object at the path.
 
Methods inherited from class com.caucho.vfs.FilesystemPath
bind, copy, createRoot, equals, getFullPath, getParent, getPath, getTail, getURL, getUserPath, hashCode, normalizePath, normalizePath, schemeWalk, setUserPath, toString
 
Methods inherited from class com.caucho.vfs.Path
createNewFile, createRoot, createTempFile, getAttribute, getAttributeNames, getContentType, getHost, getNativePath, getObject, getPort, getQuery, iterator, lookup, lookup, lookupNative, lookupNative, openAppend, openRead, openReadWrite, openReadWriteImpl, openWrite, removeAttribute, renameTo, scanScheme, setAttribute, setLastModified, setObject, unbind, 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 attributes,
                     java.lang.String path)

MemoryPath

public MemoryPath()
Method Detail

fsWalk

public Path fsWalk(java.lang.String userPath,
                   java.util.Map attributes,
                   java.lang.String path)
Description copied from class: FilesystemPath
Lookup a path relative to the current filesystem's root. Filesystems will specialize fsWalk.
Overrides:
fsWalk in class FilesystemPath
Following copied from class: com.caucho.vfs.FilesystemPath
Parameters:
userPath - the exact string passed by the user's lookup()
newAttributes - the user's new attributes
newPath - the normalized real path
Returns:
the matching path

getScheme

public java.lang.String getScheme()
Description copied from class: Path
Returns the url scheme
Overrides:
getScheme 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

getLength

public long getLength()
Description copied from class: Path
Returns the length of the file in bytes.
Overrides:
getLength in class Path
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.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
Following copied from class: com.caucho.vfs.Path
Returns:
true if successful

openReadImpl

protected StreamImpl openReadImpl()
                           throws java.io.IOException
Overrides:
openReadImpl in class Path

openWriteImpl

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

openAppendImpl

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

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

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

copyDeep

public MemoryPath copyDeep()