gov.nasa.pds.citool.target
Class Target

java.lang.Object
  extended by gov.nasa.pds.citool.target.Target

public class Target
extends Object

Class to support target URLs, files, and directories.

Author:
mcayanan

Constructor Summary
Target(String target)
          Constructor
 
Method Summary
 boolean isDirectory()
          Determine if the target is a directory
 String toString()
          Get the target name.
 URL toURL()
          Convert the target to a URL.
 List<URL> traverse(boolean recurse)
          Traverse the target directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

Overrides:
toString in class Object
Returns:
A string representation of the target.

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


Copyright © 2010–2015 Planetary Data System. All rights reserved.