org.gjt.rec.io
Class FilePath

java.lang.Object
  |
  +--org.gjt.rec.io.FilePath

public final class FilePath
extends Object

Parses a classpath or sourcepath separated by the path seperator for the platform (typically either colon or semicolon) into a list of path elements, which can be folders, JAR files or ZIP files. When a path element does not exist, its type will be guessed. If the file name ends with ".zip" or ".jar", it will be guessed as a ZIP or a JAR respectively and a directory otherwise. Should the path element become available, its type will be inspected properly.

Author:
Neil Stockbridge

Nested Class Summary
static class FilePath.PathElement
          Represents a single element of a FilePath.
 
Field Summary
static String COPYRIGHT
           
static String LICENSE
           
static String REVISION
           
 
Constructor Summary
FilePath(String pathString)
          Constructs a new FilePath from a particular path string but using the default element separator for the platform.
FilePath(String pathString, String elementSeperator)
          Constructs a new FilePath from a particular path string and a particular path element separator.
 
Method Summary
 boolean equals(Object obj)
           
 FilePath.PathElement get(int index)
          Returns a particular element from this path.
 int hashCode()
           
 int size()
          Returns the number of elements in this path.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final String COPYRIGHT
See Also:
Constant Field Values

LICENSE

public static final String LICENSE
See Also:
Constant Field Values

REVISION

public static final String REVISION
See Also:
Constant Field Values
Constructor Detail

FilePath

public FilePath(String pathString)
Constructs a new FilePath from a particular path string but using the default element separator for the platform.

Parameters:
pathString - the path string to be parsed
Throws:
NullPointerException - if (pathString) is null

FilePath

public FilePath(String pathString,
                String elementSeperator)
Constructs a new FilePath from a particular path string and a particular path element separator.

Parameters:
pathString - the path string to be parsed
elementSeperator - the character or characters that constitute a delimiter between elements
Throws:
NullPointerException - if either argument is null
Method Detail

size

public int size()
Returns the number of elements in this path.

Returns:
the number of elements in this path

get

public FilePath.PathElement get(int index)
Returns a particular element from this path.

Parameters:
index - the index of the element to return
Returns:
The element at the specified index in this path
Throws:
IndexOutOfBoundsException - if index is out of bounds (index < 0 || size() <= index)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object