Package gw.fs
Class DelegateDirectory
- java.lang.Object
-
- gw.fs.DelegateDirectory
-
- All Implemented Interfaces:
IDirectory,IResource
- Direct Known Subclasses:
AdditionalDirectory
public abstract class DelegateDirectory extends Object implements IDirectory
-
-
Constructor Summary
Constructors Constructor Description DelegateDirectory(IDirectory delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCaches()booleancreate()booleandelete()IDirectorydir(String relativePath)booleanexists()Indicates whether this resource exists.IFilefile(String path)Constucts a file given the path.IDirectorygetDelegate()StringgetName()Gets this file's or directory's name.IDirectorygetParent()Gets this file's our directory's parent directory.ResourcePathgetPath()booleanhasChildFile(String path)Returns true if the given path represents a child of this directory that exists.booleanisChildOf(IDirectory dir)Indicates whether this resource is a direct child of the given directory.booleanisDescendantOf(IDirectory dir)Indicates whether this resource is a descendant of the given directory.booleanisInJar()booleanisJavaFile()List<? extends IDirectory>listDirs()List<? extends IFile>listFiles()booleanmkdir()StringrelativePath(IResource resource)FiletoJavaFile()URItoURI()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gw.fs.IDirectory
isAdditional
-
-
-
-
Constructor Detail
-
DelegateDirectory
public DelegateDirectory(IDirectory delegate)
-
-
Method Detail
-
getDelegate
public IDirectory getDelegate()
-
dir
public IDirectory dir(String relativePath)
- Specified by:
dirin interfaceIDirectory
-
file
public IFile file(String path)
Description copied from interface:IDirectoryConstucts a file given the path. If the path is relative path, it will be constructed based on the current directory- Specified by:
filein interfaceIDirectory- Parameters:
path- the path of the file- Returns:
- The file that is under the directory with the name
-
mkdir
public boolean mkdir() throws IOException- Specified by:
mkdirin interfaceIDirectory- Throws:
IOException
-
listDirs
public List<? extends IDirectory> listDirs()
- Specified by:
listDirsin interfaceIDirectory
-
listFiles
public List<? extends IFile> listFiles()
- Specified by:
listFilesin interfaceIDirectory
-
relativePath
public String relativePath(IResource resource)
- Specified by:
relativePathin interfaceIDirectory
-
clearCaches
public void clearCaches()
- Specified by:
clearCachesin interfaceIDirectory
-
getParent
public IDirectory getParent()
Description copied from interface:IResourceGets this file's our directory's parent directory.
-
getName
public String getName()
Description copied from interface:IResourceGets this file's or directory's name.
-
exists
public boolean exists()
Description copied from interface:IResourceIndicates whether this resource exists.
-
delete
public boolean delete() throws IOException- Specified by:
deletein interfaceIResource- Throws:
IOException
-
getPath
public ResourcePath getPath()
-
isChildOf
public boolean isChildOf(IDirectory dir)
Description copied from interface:IResourceIndicates whether this resource is a direct child of the given directory.
-
isDescendantOf
public boolean isDescendantOf(IDirectory dir)
Description copied from interface:IResourceIndicates whether this resource is a descendant of the given directory.- Specified by:
isDescendantOfin interfaceIResource- Parameters:
dir- the directory which would be the ancestor- Returns:
- true if this is a descendant of the given directory
-
toJavaFile
public File toJavaFile()
- Specified by:
toJavaFilein interfaceIResource
-
isJavaFile
public boolean isJavaFile()
- Specified by:
isJavaFilein interfaceIResource
-
hasChildFile
public boolean hasChildFile(String path)
Description copied from interface:IDirectoryReturns true if the given path represents a child of this directory that exists. It's essentially equivalent to calling file(path).exists(), but in cases where this directory caches its list of children and the path represents a direct child of this directory, this method can be optimized to avoid file system access by looking in the list of cached children.- Specified by:
hasChildFilein interfaceIDirectory- Parameters:
path- the path of the file- Returns:
- true if the path represents a file that exists as a child of this directory
-
-