com.jscape.filetransfer

## Class FileTransferRemoteSort

- java.lang.Object
- - com.jscape.filetransfer.FileTransferRemoteSort

-     public class FileTransferRemoteSort
      extends java.lang.Object

  Sorts an `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();

  Author:
    Alvaro

- - ### Nested Class Summary

    Nested Classes
    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 Summary

    Constructors
    Constructor and Description
    `FileTransferRemoteSort(java.util.Enumeration e, FileTransferRemoteSort.FileTransferRemoteComparator comparator)` Creates a new `FileTransferRemoteSort` instance used to sort an `Enumeration` of `FileTransferRemoteFile`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FileTransferRemoteSort

          public FileTransferRemoteSort(java.util.Enumeration e,
                                        FileTransferRemoteSort.FileTransferRemoteComparator comparator)

      Creates a new `FileTransferRemoteSort` instance used to sort an `Enumeration` of `FileTransferRemoteFile`.
      Parameters:
        `e` - an `Enumeration` containing remote files
        `comparator` - the `Comparator` to use in sorting

  - ### Method Detail

    - #### getComparator

          public FileTransferRemoteSort.FileTransferRemoteComparator getComparator()

      Gets `FileTransferRemoteComparator` instance.
      Returns:
        a `FileTransferRemoteComparator`

    - #### setComparator

          public void setComparator(FileTransferRemoteSort.FileTransferRemoteComparator comparator)

      Sets `FileTransferRemoteComparator`.
      Parameters:
        `comparator` - a `FileTransferRemoteComparator`

    - #### setAscendent

          public void setAscendent(boolean ascendent)

      Sets whether sort will be performed in ascending or descending order.
      Parameters:
        `ascendent` - if `true` the data will be sorted in ascending order

    - #### isAscendent

          public boolean isAscendent()

      Gets whether sort will be performed in ascending or descending order.
      Returns:
        `true` if the data will be sorted in ascending order

    - #### setData

          public void setData(java.util.Enumeration e)

      Sets the data to be sorted.
      Parameters:
        `e` - an `Enumeration` of `FileTransferRemoteFile`

    - #### getData

          public java.util.Enumeration getData()

      Gets the data to be sorted.
      Returns:
        an `Enumeration` of `FileTranferRemoteFile`

    - #### sort

          public java.util.Enumeration sort()

      Sorts the data.
      Returns:
        a sorted `Enumeration` of `FileTransferRemoteFile`

Copyright © JSCAPE LLC. 1999-2021. All Rights Reserved