public class FileListGenerator extends Object
Constructor and Description |
---|
FileListGenerator()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 inputBadLocationException
IOException
public FileList visitDir(File dir, boolean getSubDirs) throws IOException
dir
- the name of the directorygetSubDirs
- 'true' to get a list of sub-directoriesIOException
public FileList crawl(URL url, boolean getSubDirURLs) throws IOException, BadLocationException
url
- The URL to crawlgetSubDirURLs
- Set to 'true' to retrieve sub-directory URLs, 'false' otherwiseIOException
BadLocationException
public Set getHyperLinks(URL url) throws IOException, BadLocationException, NullPointerException
url
- locationIOException
BadLocationException
NullPointerException
public List getFileURLNames(URL url, Set links) throws MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URLMalformedURLException
public List getSubDirURLNames(URL url, Set links) throws MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URLMalformedURLException
public boolean isLinkFile(String link)
link
- The hyperlink name to examineCopyright © 2010–2016 Planetary Data System. All rights reserved.