|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nasa.pds.citool.file.FileListGenerator
public class FileListGenerator
Class that can generate a list of files from a supplied directory and optionally, a specified filter. The resulting files and directories are stored in a FileList.
Constructor Summary | |
---|---|
FileListGenerator()
Default constructor |
Method Summary | |
---|---|
FileList |
crawl(URL url,
boolean getSubDirURLs)
Crawls a directory URL, looking for files and sub-directories. |
List |
getFileURLNames(URL url,
Set links)
Finds links to files. |
Set |
getHyperLinks(URL url)
Gets hyperlinks found in an HTML document of a URL. |
List |
getSubDirURLNames(URL url,
Set links)
Finds links to sub-directory URLs |
boolean |
isLinkFile(String link)
Determines if a hyperlink is a file. |
boolean |
isLinkSubDir(URL url,
String link)
Determines if a hyperlink is a sub-directory. |
void |
setFilters(List regexp,
List noFiles,
List noDirs)
Sets all possible filters when looking in a directory. |
FileList |
visitDir(File dir,
boolean getSubDirs)
Gets a list of files under a given directory. |
FileList |
visitTarget(String target,
boolean getSubDirs)
Allows one to pass in a file or URL. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileListGenerator()
Method Detail |
---|
public void setFilters(List regexp, List noFiles, List noDirs)
regexp
- File patterns to include when finding files in a directorynoFiles
- File patterns to ignore when finding files in a directorynoDirs
- Directory patterns to ignore when finding sub-directoriespublic FileList visitTarget(String target, boolean getSubDirs) throws IOException, BadLocationException
getSubDirs
- 'true' to look for sub-directories, 'false' to just search for files when
given a directory as input
BadLocationException
IOException
public FileList visitDir(File dir, boolean getSubDirs) throws IOException
dir
- the name of the directorygetSubDirs
- 'true' to get a list of sub-directories
IOException
public FileList crawl(URL url, boolean getSubDirURLs) throws IOException, BadLocationException
url
- The URL to crawlgetSubDirURLs
- Set to 'true' to retrieve sub-directory URLs, 'false' otherwise
IOException
BadLocationException
public Set getHyperLinks(URL url) throws IOException, BadLocationException, NullPointerException
url
- location
IOException
BadLocationException
NullPointerException
public List getFileURLNames(URL url, Set links) throws MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URL
MalformedURLException
public List getSubDirURLNames(URL url, Set links) throws MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URL
MalformedURLException
public boolean isLinkFile(String link)
link
- The hyperlink name to examine
public boolean isLinkSubDir(URL url, String link)
url
- The locationlink
- The hyperlink name to examine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |