public class VirtualDirectoryPath extends Object implements DirectoryPath
This virtual DirectoryPath
is based on a several other DirectoryPath
and proxy method call to them
when getChild(String)
list()
, getLastUpdate()
are called.
Note that since there are multiple parent, a UnsupportedOperationException
will be thrown is
getAbsolutePath()
and getParent()
are called.
Constructor and Description |
---|
VirtualDirectoryPath(String n,
List<DirectoryPath> directories)
Builds a new instance.
|
Modifier and Type | Method and Description |
---|---|
String |
getAbsolutePath()
Returns the absolute path of this path by separating each parent path with a standard
separator . |
Path |
getChild(String path)
Gets the
Path corresponding to the given String which should be interpreted relatively to
this directory. |
long |
getLastUpdate()
Gets the last update date of this path.
|
String |
getName()
Returns the path name.
|
DirectoryPath |
getParent()
Returns the parent path.
|
String[] |
list()
Lists all the children path names of this directory.
|
public VirtualDirectoryPath(String n, List<DirectoryPath> directories)
Builds a new instance.
n
- the namedirectories
- the directoriespublic Path getChild(String path) throws IOException
Gets the Path
corresponding to the given String
which should be interpreted relatively to
this directory.
getChild
in interface DirectoryPath
path
- the path representing the child relatively to this directoryIOException
- if any I/O error occurspublic String[] list() throws IOException
Lists all the children path names of this directory.
list
in interface DirectoryPath
IOException
- if any I/O error occurspublic String getName()
Returns the path name.
public DirectoryPath getParent()
Returns the parent path. Should be null
if this path is considered as a root.
public String getAbsolutePath()
Returns the absolute path of this path by separating each parent path with a standard
separator
.
getAbsolutePath
in interface Path
public long getLastUpdate() throws IOException
Gets the last update date of this path.
getLastUpdate
in interface Path
IOException
- if an I/O error occurs while accessing path dataCopyright © 2012-2015. All Rights Reserved.