public class FileListGenerator
extends java.lang.Object
Constructor and Description |
---|
FileListGenerator()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
FileList |
crawl(java.net.URL url,
boolean getSubDirURLs)
Crawls a directory URL, looking for files and sub-directories.
|
java.util.List |
getFileURLNames(java.net.URL url,
java.util.Set links)
Finds links to files.
|
java.util.Set |
getHyperLinks(java.net.URL url)
Gets hyperlinks found in an HTML document of a URL.
|
java.util.List |
getSubDirURLNames(java.net.URL url,
java.util.Set links)
Finds links to sub-directory URLs
|
boolean |
isLinkFile(java.lang.String link)
Determines if a hyperlink is a file.
|
boolean |
isLinkSubDir(java.net.URL url,
java.lang.String link)
Determines if a hyperlink is a sub-directory.
|
void |
setFilters(java.util.List regexp,
java.util.List noFiles,
java.util.List noDirs)
Sets all possible filters when looking in a directory.
|
FileList |
visitDir(java.io.File dir,
boolean getSubDirs)
Gets a list of files under a given directory.
|
FileList |
visitTarget(java.lang.String target,
boolean getSubDirs)
Allows one to pass in a file or URL.
|
public void setFilters(java.util.List regexp, java.util.List noFiles, java.util.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(java.lang.String target, boolean getSubDirs) throws java.io.IOException, javax.swing.text.BadLocationException
getSubDirs
- 'true' to look for sub-directories, 'false' to just search for files when
given a directory as inputjavax.swing.text.BadLocationException
java.io.IOException
public FileList visitDir(java.io.File dir, boolean getSubDirs) throws java.io.IOException
dir
- the name of the directorygetSubDirs
- 'true' to get a list of sub-directoriesjava.io.IOException
public FileList crawl(java.net.URL url, boolean getSubDirURLs) throws java.io.IOException, javax.swing.text.BadLocationException
url
- The URL to crawlgetSubDirURLs
- Set to 'true' to retrieve sub-directory URLs, 'false' otherwisejava.io.IOException
javax.swing.text.BadLocationException
public java.util.Set getHyperLinks(java.net.URL url) throws java.io.IOException, javax.swing.text.BadLocationException, java.lang.NullPointerException
url
- locationjava.io.IOException
javax.swing.text.BadLocationException
java.lang.NullPointerException
public java.util.List getFileURLNames(java.net.URL url, java.util.Set links) throws java.net.MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URLjava.net.MalformedURLException
public java.util.List getSubDirURLNames(java.net.URL url, java.util.Set links) throws java.net.MalformedURLException
url
- The locationlinks
- The Set of files and directories found inside the URLjava.net.MalformedURLException
public boolean isLinkFile(java.lang.String link)
link
- The hyperlink name to examinepublic boolean isLinkSubDir(java.net.URL url, java.lang.String link)
url
- The locationlink
- The hyperlink name to examineCopyright © 2010-2019 Planetary Data System. All Rights Reserved.