Package gov.nasa.pds.citool.target
Class Target
- java.lang.Object
-
- gov.nasa.pds.citool.target.Target
-
public class Target extends Object
Class to support target URLs, files, and directories.- Author:
- mcayanan
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isDirectory()
Determine if the target is a directoryString
toString()
Get the target name.URL
toURL()
Convert the target to a URL.List<URL>
traverse(boolean recurse)
Traverse the target directory.
-
-
-
Constructor Detail
-
Target
public Target(String target)
Constructor- Parameters:
target
- A file, URL, or directory.
-
-
Method Detail
-
isDirectory
public boolean isDirectory()
Determine if the target is a directory- Returns:
- 'true' if the target is a directory, 'false' otherwise
-
toString
public String toString()
Get the target name.
-
toURL
public URL toURL() throws MalformedURLException
Convert the target to a URL.- Returns:
- a URL representation of the target
- Throws:
MalformedURLException
-
traverse
public List<URL> traverse(boolean recurse) throws IOException, BadLocationException
Traverse the target directory.- Parameters:
recurse
- Set to 'true' to recursively traverse the target, 'false' otherwise- Returns:
- A list of URLs or an empty list if the target is not a directory
- Throws:
BadLocationException
IOException
-
-