public class FileLocation extends AbstractLocation implements BrowsableLocation
Constructor and Description |
---|
FileLocation(File file) |
FileLocation(String path) |
FileLocation(URI path) |
Modifier and Type | Method and Description |
---|---|
FileLocation |
child(String name)
Obtains a location with the given name, for whom this location is the
parent.
|
Set<BrowsableLocation> |
children()
Obtains a collection of locations for whom this location is the parent.
|
File |
getFile()
Gets the associated
File . |
String |
getName()
Gets a (typically short) name expressing this location.
|
URI |
getURI()
Gets the location expressed as a
URI , or null if the location
cannot be expressed as such. |
boolean |
isDirectory()
Tests whether this location is a directory, meaning that it can have
children.
|
FileLocation |
parent()
Obtains a location pointing to the parent directory of this one.
|
FileLocation |
sibling(String path)
Obtains a location relative to this one, which will be configured
like the current location, but point to a the file specified by the
path parameter. |
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
defaultName
public FileLocation(File file)
public FileLocation(String path)
public FileLocation(URI path)
public URI getURI()
Location
URI
, or null if the location
cannot be expressed as such.public String getName()
Location
public FileLocation parent() throws IOException
BrowsableLocation
parent
in interface BrowsableLocation
null
if this
location has no parent.IOException
- if something goes wrong obtaining the parent.public Set<BrowsableLocation> children() throws IOException
BrowsableLocation
BrowsableLocation.isDirectory()
on this
location return true
.children
in interface BrowsableLocation
Collections.EMPTY_SET
if this location has no children.IOException
- if something goes wrong obtaining the children.public FileLocation sibling(String path)
BrowsableLocation
path
parameter.sibling
in interface BrowsableLocation
path
- the relative path of the desired location.public FileLocation child(String name)
BrowsableLocation
BrowsableLocation.isDirectory()
on this location return true
.child
in interface BrowsableLocation
name
- the name of the childpublic boolean isDirectory()
BrowsableLocation
BrowsableLocation.child(String)
or BrowsableLocation.children()
, to ensure those calls
succeed.isDirectory
in interface BrowsableLocation
Copyright © 2015–2022 SciJava. All rights reserved.