gov.nasa.pds.vtool.target
Class Target

java.lang.Object
  extended by gov.nasa.pds.vtool.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<Target> traverse(boolean recurse, List<String> filesToFind, List<String> filesToSkip, List<String> dirsToSkip)
          Traverse the target directory.
 List<Target> traverse(List<String> filesToFind, List<String> filesToSkip, List<String> dirsToSkip)
           
 
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<Target> traverse(List<String> filesToFind,
                             List<String> filesToSkip,
                             List<String> dirsToSkip)
                      throws Exception
Throws:
Exception

traverse

public List<Target> traverse(boolean recurse,
                             List<String> filesToFind,
                             List<String> filesToSkip,
                             List<String> dirsToSkip)
                      throws Exception
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:
Exception - If there was an error traversing the directory.


Copyright © 2005-2014 Planetary Data System. All Rights Reserved.