public abstract class AbstractDirectoryLister extends java.lang.Object implements DirectoryLister, java.lang.Cloneable
AbstractDirectoryLister
is an abstract helper that
implements most of the DirectoryLister
methods. Child
classes need only implement:
DirectoryLister.Entry
Constructor and Description |
---|
AbstractDirectoryLister()
Creates a new lister with empty directory name.
|
Modifier and Type | Method and Description |
---|---|
protected abstract java.util.List |
buildEntryList(java.lang.String name)
Builds the list of directory entries.
|
void |
clear()
Clears the directory name and entry list.
|
java.lang.Object |
clone()
Gets a copy of this object.
|
java.lang.String |
getDirectory()
Gets the directory name.
|
java.util.List |
getEntries()
Gets the list of directory entries.
|
void |
refresh()
Refreshes the entry list based on the current directory name.
|
void |
setDirectory(java.lang.String name)
Sets the directory name.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChild, getParent
public AbstractDirectoryLister()
public java.lang.String getDirectory()
getDirectory
in interface DirectoryLister
public java.lang.Object clone()
clone
in interface DirectoryLister
clone
in class java.lang.Object
public void setDirectory(java.lang.String name) throws java.io.IOException
setDirectory
in interface DirectoryLister
name
- the new directory name.java.io.IOException
- if an error occurred getting the entries for
the new directory.protected abstract java.util.List buildEntryList(java.lang.String name) throws java.io.IOException
java.io.IOException
- if an error occurred getting the entries for
the new directory.public void refresh() throws java.io.IOException
refresh
in interface DirectoryLister
java.io.IOException
- if an error occurred getting the entries for
the new directory.public void clear()
clear
in interface DirectoryLister
public java.util.List getEntries()
getEntries
in interface DirectoryLister