Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.virtual.plugins.context.memory
Class MemoryContextHandler

    java.lang.Object
      org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
          org.jboss.virtual.plugins.context.AbstractURLHandler
              org.jboss.virtual.plugins.context.memory.MemoryContextHandler

All Implemented Interfaces:
  java.io.Serializable, StructuredVirtualFileHandler, VirtualFileHandler

    public class MemoryContextHandler

extends AbstractURLHandler
implements StructuredVirtualFileHandler

Virtual memory context handler.

Version:
  $Revision: 1.1 $
Author:
  Kabir Khan
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
`cachedLastModified, log, vfsUrl`

Constructor Summary
`MemoryContextHandler(VFSContext context, VirtualFileHandler parent, java.net.URL url, java.lang.String name)`

Method Summary
`protected void` | `addChild(java.lang.String name, MemoryContextHandler child)`
`VirtualFileHandler` | `createChildHandler(java.lang.String name)` Called by structuredFindChild
`boolean` | `exists()` Basis existence on URLConnection.getLastModified() != 0.
`VirtualFileHandler` | `findChild(java.lang.String path)` Find a child
`java.util.List<VirtualFileHandler>` | `getChildren(boolean ignoreErrors)` Get the children
`long` | `getLastModified()` When the file was last modified
`long` | `getSize()` Get the size
`protected void` | `initCacheLastModified()`
`boolean` | `isLeaf()` Whether it is a simple leaf of the VFS, i.e.
`java.io.InputStream` | `openStream()` Access the file contents.
`void` | `setContents(byte[] contents)`
`java.net.URL` | `toVfsUrl()` Get a VFS-based URL

Methods inherited from class org.jboss.virtual.plugins.context.AbstractURLHandler
`getURL, isHidden, toURI, toURL`

Methods inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
`checkClosed, close, decrement, doClose, equals, getName, getParent, getPathName, getVFSContext, getVirtualFile, hasBeenModified, hashCode, increment, setPathName, simpleFindChild, structuredFindChild, toString`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MemoryContextHandler

    public MemoryContextHandler(VFSContext context,
                                VirtualFileHandler parent,
                                java.net.URL url,
                                java.lang.String name)

Method Detail

### addChild

    protected void addChild(java.lang.String name,
                            MemoryContextHandler child)

### findChild

    public VirtualFileHandler findChild(java.lang.String path)
                                 throws java.io.IOException

  Description copied from interface: `VirtualFileHandler`
  Find a child

  Specified by:
    `findChild` in interface `VirtualFileHandler`
  Parameters:
    `path` - the path
  Returns:
    the child
  Throws:
    `java.io.IOException` - for an error accessing the file system (or the child doesn't exist)

### getChildren

    public java.util.List<VirtualFileHandler> getChildren(boolean ignoreErrors)
                                                   throws java.io.IOException

  Description copied from interface: `VirtualFileHandler`
  Get the children

  Specified by:
    `getChildren` in interface `VirtualFileHandler`
  Parameters:
    `ignoreErrors` - whether to ignore errors
  Returns:
    the children
  Throws:
    `java.io.IOException` - for an error accessing the file system

### isLeaf

    public boolean isLeaf()

  Description copied from interface: `VirtualFileHandler`
  Whether it is a simple leaf of the VFS, i.e. whether it can contain other files

  Specified by:
    `isLeaf` in interface `VirtualFileHandler`
  Returns:
    true if a simple file.

### createChildHandler

    public VirtualFileHandler createChildHandler(java.lang.String name)
                                          throws java.io.IOException

  Called by structuredFindChild

  Specified by:
    `createChildHandler` in interface `StructuredVirtualFileHandler`
  Parameters:
    `name` - the name
  Returns:
    the handler
  Throws:
    `java.io.IOException` - for any error accessing the virtual file system

### exists

    public boolean exists()
                   throws java.io.IOException

  Description copied from class: `AbstractURLHandler`
  Basis existence on URLConnection.getLastModified() != 0. This may not be true for all url connections.

  Specified by:
    `exists` in interface `VirtualFileHandler`
  Overrides:
    `exists` in class `AbstractURLHandler`
  Returns:
    true if the file exists, false otherwise.
  Throws:
    `java.io.IOException` - - thrown on failure to detect existence.
  See Also:
    `URLConnection.getLastModified()`, `org.jboss.test.virtual.test.URLExistsUnitTestCase`

### setContents

    public void setContents(byte[] contents)

### initCacheLastModified

    protected void initCacheLastModified()

  Overrides:
    `initCacheLastModified` in class `AbstractURLHandler`

### getSize

    public long getSize()
                 throws java.io.IOException

  Description copied from interface: `VirtualFileHandler`
  Get the size

  Specified by:
    `getSize` in interface `VirtualFileHandler`
  Overrides:
    `getSize` in class `AbstractURLHandler`
  Returns:
    the size
  Throws:
    `java.io.IOException` - for any problem accessing the virtual file system

### getLastModified

    public long getLastModified()
                         throws java.io.IOException

  Description copied from interface: `VirtualFileHandler`
  When the file was last modified

  Specified by:
    `getLastModified` in interface `VirtualFileHandler`
  Overrides:
    `getLastModified` in class `AbstractURLHandler`
  Returns:
    the last modified time
  Throws:
    `java.io.IOException` - for any problem accessing the virtual file system

### openStream

    public java.io.InputStream openStream()
                                   throws java.io.IOException

  Description copied from interface: `VirtualFileHandler`
  Access the file contents.

  Specified by:
    `openStream` in interface `VirtualFileHandler`
  Overrides:
    `openStream` in class `AbstractURLHandler`
  Returns:
    An InputStream for the file contents.
  Throws:
    `java.io.IOException` - for any problem accessing the virtual file system

### toVfsUrl

    public java.net.URL toVfsUrl()
                          throws java.net.MalformedURLException,
                                 java.net.URISyntaxException

  Description copied from interface: `VirtualFileHandler`
  Get a VFS-based URL

  Specified by:
    `toVfsUrl` in interface `VirtualFileHandler`
  Overrides:
    `toVfsUrl` in class `AbstractVirtualFileHandler`
  Returns:
    the url
  Throws:
    `java.net.MalformedURLException`
    `java.net.URISyntaxException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD