com.partnersoft.io.vfs
Class NonexistentVfsDirectory

java.lang.Object
  extended by com.partnersoft.io.vfs.AbstractVfsDirectory
      extended by com.partnersoft.io.vfs.NonexistentVfsDirectory
All Implemented Interfaces:
VfsDirectory, VfsNode

public class NonexistentVfsDirectory
extends AbstractVfsDirectory

A VfsDirectory handle for a directory that does not exist in a read-only VFS.

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
NonexistentVfsDirectory(Vfs vfs, Path path)
           
 
Method Summary
 boolean exists()
          Whether the Vfs node exists.
 java.net.URI getUri()
          URI for this VfsNode.
 java.net.URL getUrl()
          URL for this VfsNode.
 java.util.List<VfsDirectory> listDirectories()
          Lists all directories (not files) in this directory.
 java.util.List<VfsFile> listFiles()
          Lists all files (not directories) in this directory.
 java.util.List<VfsNode> listNodes()
          Lists all nodes (both directories and files) in this directory.
 void make()
          Creates the node and any ancestor directories needed to contain it.
 void remove()
          Removes the directory AND ALL ITS CONTENTS.
 java.io.File toFile()
          java.io.File for this VfsNode.
 
Methods inherited from class com.partnersoft.io.vfs.AbstractVfsDirectory
copyTo, copyTo, directoryFor, directoryFor, directoryNamed, equals, fileFor, fileFor, fileNamed, findDirectories, findDirectoriesLike, findFiles, findFilesLike, findFilesWithExtension, findNodes, findNodesLike, getAbsolutePath, getBaseName, getDirectory, getExtension, getName, getPath, getVfs, isBackup, isHidden, listDirectoriesLike, listFilesLike, listFilesWithBaseName, listFilesWithExtension, listNodesLike, moveTo, moveTo, renameTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonexistentVfsDirectory

public NonexistentVfsDirectory(Vfs vfs,
                               Path path)
Method Detail

exists

public boolean exists()
               throws java.io.IOException
Description copied from interface: VfsNode
Whether the Vfs node exists. VfsNode objects serve as addresses as well as handles, so they may not point to existing resources. Use VfsNode.make() to create the node if it does not exist.

Specified by:
exists in interface VfsDirectory
Specified by:
exists in interface VfsNode
Specified by:
exists in class AbstractVfsDirectory
Returns:
true if node exists
Throws:
java.io.IOException - if it can't tell for some reason.

listDirectories

public java.util.List<VfsDirectory> listDirectories()
                                             throws java.io.IOException
Description copied from interface: VfsDirectory
Lists all directories (not files) in this directory. Returns an empty list if the directory does not exist.

Specified by:
listDirectories in interface VfsDirectory
Specified by:
listDirectories in class AbstractVfsDirectory
Returns:
list of directories
Throws:
java.io.IOException

listFiles

public java.util.List<VfsFile> listFiles()
                                  throws java.io.IOException
Description copied from interface: VfsDirectory
Lists all files (not directories) in this directory. Returns an empty list if the directory does not exist.

Specified by:
listFiles in interface VfsDirectory
Specified by:
listFiles in class AbstractVfsDirectory
Returns:
list of files
Throws:
java.io.IOException

listNodes

public java.util.List<VfsNode> listNodes()
                                  throws java.io.IOException
Description copied from interface: VfsDirectory
Lists all nodes (both directories and files) in this directory. Returns an empty list if the directory does not exist.

Specified by:
listNodes in interface VfsDirectory
Specified by:
listNodes in class AbstractVfsDirectory
Returns:
list of nodes
Throws:
java.io.IOException - if listing fails

make

public void make()
          throws java.io.IOException
Description copied from interface: VfsNode
Creates the node and any ancestor directories needed to contain it.

Specified by:
make in interface VfsDirectory
Specified by:
make in interface VfsNode
Specified by:
make in class AbstractVfsDirectory
Throws:
java.io.IOException - if it can't.

remove

public void remove()
            throws java.io.IOException
Description copied from interface: VfsDirectory
Removes the directory AND ALL ITS CONTENTS. Use with caution.

Throws:
java.io.IOException

getUri

public java.net.URI getUri()
Description copied from interface: VfsNode
URI for this VfsNode. Returns null if for some reason a URI cannot be supplied or is not applicable.


getUrl

public java.net.URL getUrl()
Description copied from interface: VfsNode
URL for this VfsNode. Returns null if for some reason a URL cannot be supplied or is not applicable.


toFile

public java.io.File toFile()
Description copied from interface: VfsNode
java.io.File for this VfsNode. Returns null if it's not a regular file (e.g. in a URL-based VFS).