Class FileTransfer


  • public final class FileTransfer
    extends Object
    A class for managing a single file transfer. It allows to monitor the progress and status of a file transfer by adding a listener.
    • Method Detail

      • getStatus

        public final FileTransfer.Status getStatus()
        Gets the status of the file transfer.
        Returns:
        The status.
      • isDone

        public final boolean isDone()
        Returns true, if the file transfer is done, i.e. neither in progress nor in initial status.
        Returns:
        True, if the file transfer is done.
      • getBytesTransferred

        public long getBytesTransferred()
        Gets the transferred bytes.
        Returns:
        The transferred bytes.
      • getProgress

        public final double getProgress()
        Gets the progress of the file transfer.
        Returns:
        A value between 0 and 1 indicating the progress or -1 if the progress is unknown.
      • transfer

        public final Future<?> transfer()
        Transfers the file in its own thread.
        Returns:
        The future which is done when transferring is complete.
      • cancel

        public void cancel()
        Cancels the file transfer.
      • getSessionId

        public final String getSessionId()
        Gets the session id for this file transfer session.
        Returns:
        The session id.