public class HTTPDirectoryLister extends AbstractDirectoryLister
HTTPDirectoryLister
lists directory contents over
an HTTP connection. The directory name used must be a valid HTTP
protocol URL (ie: start with http://
). The URL
contents must be an HTTP server directory listing rather than a
normal web page. The HTML content of the directory listing is
parsed to extract the file and directory names. A custom filter
may be set to filter the directory entries returned by the lister.DirectoryLister.Entry
Constructor and Description |
---|
HTTPDirectoryLister() |
Modifier and Type | Method and Description |
---|---|
protected java.util.List |
buildEntryList(java.lang.String name)
Builds the list of directory entries.
|
java.lang.String |
getChild(java.lang.String parent,
java.lang.String child)
Gets the full child directory name for the specified parent and
child.
|
java.lang.String |
getParent(java.lang.String name)
Gets the parent directory name for the specified directory.
|
static void |
main(java.lang.String[] argv)
Tests this class.
|
void |
refresh()
Refreshes the entry list based on the current directory name.
|
void |
setRefFilter(StringFilter filter)
Sets the directory entry filter.
|
clear, clone, getDirectory, getEntries, setDirectory
public void setRefFilter(StringFilter filter)
filter
- the new filter or null for no filtering (the
default).public java.lang.String getParent(java.lang.String name)
DirectoryLister
name
- the name of the directory to get the parent.public java.lang.String getChild(java.lang.String parent, java.lang.String child)
DirectoryLister
parent
- the parent base directory.child
- the child directory within the parent.protected java.util.List buildEntryList(java.lang.String name) throws java.io.IOException
AbstractDirectoryLister
buildEntryList
in class AbstractDirectoryLister
java.io.IOException
- if an error occurred getting the entries for
the new directory.public void refresh() throws java.io.IOException
AbstractDirectoryLister
refresh
in interface DirectoryLister
refresh
in class AbstractDirectoryLister
java.io.IOException
- if an error occurred getting the entries for
the new directory.public static void main(java.lang.String[] argv) throws java.lang.Exception
argv
- the array of command line parameters.java.lang.Exception