Class TransportListener

  • Direct Known Subclasses:
    TransferTransportListener

    public abstract class TransportListener
    extends java.lang.Object
    A skeleton class for listeners used to monitor transport operations. Reusing common regular expression syntax, the sequence of events is generally as follows:
     ( STARTED PROGRESSED* )*
     
    The methods in this class do nothing.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TransportListener()
      Enables subclassing.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void transportProgressed​(java.nio.ByteBuffer data)
      Notifies the listener about some progress in the data transfer.
      void transportStarted​(long dataOffset, long dataLength)
      Notifies the listener about the start of the data transfer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransportListener

        protected TransportListener()
        Enables subclassing.
    • Method Detail

      • transportStarted

        public void transportStarted​(long dataOffset,
                                     long dataLength)
                              throws TransferCancelledException
        Notifies the listener about the start of the data transfer. This event may arise more than once if the transfer needs to be restarted (e.g. after an authentication failure).
        Parameters:
        dataOffset - The byte offset in the resource at which the transfer starts, must not be negative.
        dataLength - The total number of bytes in the resource or -1 if the length is unknown.
        Throws:
        TransferCancelledException - If the transfer should be aborted.
      • transportProgressed

        public void transportProgressed​(java.nio.ByteBuffer data)
                                 throws TransferCancelledException
        Notifies the listener about some progress in the data transfer. This event may even be fired if actually zero bytes have been transferred since the last event, for instance to enable cancellation.
        Parameters:
        data - The (read-only) buffer holding the bytes that have just been tranferred, must not be null.
        Throws:
        TransferCancelledException - If the transfer should be aborted.