public class FileTransferRemoteSort
extends java.lang.Object
Enumeration of FileTransferRemoteFile. The user must
specify a Comparator instance which will be used by the sort algorithm.
The following is an example usage
FtpTransfer ftp = new FtpTransfer(host, user, password, port);
ftp.connect();
// Get the remote files enumeration
Enumeration e = ftp.getDirListing();
//Creates the sorter with the file date comparator
FileTransferRemoteSort sorter = new FileTransferRemoteSort(e,
new FileTransferRemoteSort.FileDateComparator());
// sort in ascending order
sorter.setAscendent(true);
// sorts enumeration
e = sorter.sort();
| Modifier and Type | Class and Description |
|---|---|
static class |
FileTransferRemoteSort.FileDateComparator
Sorts files by date.
|
static class |
FileTransferRemoteSort.FileNameComparator
Sorts files by name.
|
static class |
FileTransferRemoteSort.FileSizeComparator
Sorts files by filesize.
|
static class |
FileTransferRemoteSort.FileTransferRemoteComparator
This the base comparator class.
|
| Constructor and Description |
|---|
FileTransferRemoteSort(java.util.Enumeration e,
FileTransferRemoteSort.FileTransferRemoteComparator comparator)
Creates a new
FileTransferRemoteSort instance used to sort an Enumeration of FileTransferRemoteFile. |
| Modifier and Type | Method and Description |
|---|---|
FileTransferRemoteSort.FileTransferRemoteComparator |
getComparator()
Gets
FileTransferRemoteComparator instance. |
java.util.Enumeration |
getData()
Gets the data to be sorted.
|
boolean |
isAscendent()
Gets whether sort will be performed in ascending or descending order.
|
void |
setAscendent(boolean ascendent)
Sets whether sort will be performed in ascending or descending order.
|
void |
setComparator(FileTransferRemoteSort.FileTransferRemoteComparator comparator)
Sets
FileTransferRemoteComparator. |
void |
setData(java.util.Enumeration e)
Sets the data to be sorted.
|
java.util.Enumeration |
sort()
Sorts the data.
|
public FileTransferRemoteSort(java.util.Enumeration e,
FileTransferRemoteSort.FileTransferRemoteComparator comparator)
FileTransferRemoteSort instance used to sort an Enumeration of FileTransferRemoteFile.e - an Enumeration containing remote filescomparator - the Comparator to use in sortingpublic FileTransferRemoteSort.FileTransferRemoteComparator getComparator()
FileTransferRemoteComparator instance.FileTransferRemoteComparatorpublic void setComparator(FileTransferRemoteSort.FileTransferRemoteComparator comparator)
FileTransferRemoteComparator.comparator - a FileTransferRemoteComparatorpublic void setAscendent(boolean ascendent)
ascendent - if true the data will be sorted in ascending orderpublic boolean isAscendent()
true if the data will be sorted in ascending orderpublic void setData(java.util.Enumeration e)
e - an Enumeration of FileTransferRemoteFilepublic java.util.Enumeration getData()
Enumeration of FileTranferRemoteFilepublic java.util.Enumeration sort()
Enumeration of FileTransferRemoteFileCopyright © JSCAPE LLC. 1999-2023. All Rights Reserved