Class AsyncSenderImpl

  • All Implemented Interfaces:
    Sender

    public class AsyncSenderImpl
    extends java.lang.Object
    implements Sender
    Author:
    Stuart Douglas
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this sender asynchronously
      void close​(IoCallback callback)
      Closes this sender asynchronously.
      void send​(java.lang.String data)
      Write the given String using async IO, and ends the exchange when done
      void send​(java.lang.String data, IoCallback callback)
      Write the given String using async IO, and calls the given callback on completion or error.
      void send​(java.lang.String data, java.nio.charset.Charset charset)
      Write the given String using async IO, and ends the exchange when done
      void send​(java.lang.String data, java.nio.charset.Charset charset, IoCallback callback)
      Write the given String using async IO, and calls the given callback on completion or error.
      void send​(java.nio.ByteBuffer buffer)
      Write the given buffer using async IO, and ends the exchange when done
      void send​(java.nio.ByteBuffer[] buffer)
      Write the given buffers using async IO, and ends the exchange when done
      void send​(java.nio.ByteBuffer[] buffer, IoCallback callback)
      Write the given buffers using async IO, and calls the given callback on completion or error.
      void send​(java.nio.ByteBuffer buffer, IoCallback callback)
      Write the given buffer using async IO, and calls the given callback on completion or error.
      void transferFrom​(java.nio.channels.FileChannel source, IoCallback callback)
      Transfers all content from the specified file
      • Methods inherited from class java.lang.Object

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

      • send

        public void send​(java.nio.ByteBuffer buffer,
                         IoCallback callback)
        Description copied from interface: Sender
        Write the given buffer using async IO, and calls the given callback on completion or error.
        Specified by:
        send in interface Sender
        Parameters:
        buffer - The buffer to send.
        callback - The callback
      • send

        public void send​(java.nio.ByteBuffer[] buffer,
                         IoCallback callback)
        Description copied from interface: Sender
        Write the given buffers using async IO, and calls the given callback on completion or error.
        Specified by:
        send in interface Sender
        Parameters:
        buffer - The buffers to send.
        callback - The callback
      • transferFrom

        public void transferFrom​(java.nio.channels.FileChannel source,
                                 IoCallback callback)
        Description copied from interface: Sender
        Transfers all content from the specified file
        Specified by:
        transferFrom in interface Sender
        Parameters:
        source - the file channel to transfer
        callback - The callback
      • send

        public void send​(java.nio.ByteBuffer buffer)
        Description copied from interface: Sender
        Write the given buffer using async IO, and ends the exchange when done
        Specified by:
        send in interface Sender
        Parameters:
        buffer - The buffer to send.
      • send

        public void send​(java.nio.ByteBuffer[] buffer)
        Description copied from interface: Sender
        Write the given buffers using async IO, and ends the exchange when done
        Specified by:
        send in interface Sender
        Parameters:
        buffer - The buffers to send.
      • send

        public void send​(java.lang.String data,
                         IoCallback callback)
        Description copied from interface: Sender
        Write the given String using async IO, and calls the given callback on completion or error.

        The CharSequence is encoded to UTF8

        Specified by:
        send in interface Sender
        Parameters:
        data - The data to send
        callback - The callback
      • send

        public void send​(java.lang.String data,
                         java.nio.charset.Charset charset,
                         IoCallback callback)
        Description copied from interface: Sender
        Write the given String using async IO, and calls the given callback on completion or error.
        Specified by:
        send in interface Sender
        Parameters:
        data - The buffer to end.
        charset - The charset to use
        callback - The callback
      • send

        public void send​(java.lang.String data)
        Description copied from interface: Sender
        Write the given String using async IO, and ends the exchange when done

        The CharSequence is encoded to UTF8

        Specified by:
        send in interface Sender
        Parameters:
        data - The data to send
      • send

        public void send​(java.lang.String data,
                         java.nio.charset.Charset charset)
        Description copied from interface: Sender
        Write the given String using async IO, and ends the exchange when done
        Specified by:
        send in interface Sender
        Parameters:
        data - The buffer to end.
        charset - The charset to use
      • close

        public void close​(IoCallback callback)
        Description copied from interface: Sender
        Closes this sender asynchronously. The given callback is notified on completion
        Specified by:
        close in interface Sender
        Parameters:
        callback - The callback that is notified when all data has been flushed and the channel is closed
      • close

        public void close()
        Description copied from interface: Sender
        Closes this sender asynchronously
        Specified by:
        close in interface Sender