io.undertow.io

## Interface Sender

All Known Implementing Classes:
  AsyncSenderImpl, BlockingSenderImpl, ResponseCachingSender

    public interface Sender

Sender interface that allows for callback based async IO. Note that all methods on this class are asynchronous, and may result in dispatch to an IO thread. After calling a method on this class you should not perform any more work on the current exchange until the callback is invoked. NOTE: implementers of this interface should be careful that they do not recursively call onComplete, which can lead to stack overflows if send is called many times.

Author:
  Stuart Douglas

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `close()` Closes this sender asynchronously
`void` `close(IoCallback callback)` Closes this sender asynchronously.
`void` `send(ByteBuffer buffer)` Write the given buffer using async IO, and ends the exchange when done
`void` `send(ByteBuffer[] buffer)` Write the given buffers using async IO, and ends the exchange when done
`void` `send(ByteBuffer[] buffer, IoCallback callback)` Write the given buffers using async IO, and calls the given callback on completion or error.
`void` `send(ByteBuffer buffer, IoCallback callback)` Write the given buffer using async IO, and calls the given callback on completion or error.
`void` `send(String data)` Write the given String using async IO, and ends the exchange when done
`void` `send(String data, Charset charset)` Write the given String using async IO, and ends the exchange when done
`void` `send(String data, Charset charset, IoCallback callback)` Write the given String using async IO, and calls the given callback on completion or error.
`void` `send(String data, IoCallback callback)` Write the given String using async IO, and calls the given callback on completion or error.
`void` `transferFrom(FileChannel channel, IoCallback callback)` Transfers all content from the specified file

### Method Detail

#### send

    void send(ByteBuffer buffer,
              IoCallback callback)

Write the given buffer using async IO, and calls the given callback on completion or error.

Parameters:
  `buffer` - The buffer to send.
  `callback` - The callback

#### send

    void send(ByteBuffer[] buffer,
              IoCallback callback)

Write the given buffers using async IO, and calls the given callback on completion or error.

Parameters:
  `buffer` - The buffers to send.
  `callback` - The callback

#### send

    void send(ByteBuffer buffer)

Write the given buffer using async IO, and ends the exchange when done

Parameters:
  `buffer` - The buffer to send.

#### send

    void send(ByteBuffer[] buffer)

Write the given buffers using async IO, and ends the exchange when done

Parameters:
  `buffer` - The buffers to send.

#### send

    void send(String data,
              IoCallback callback)

Write the given String using async IO, and calls the given callback on completion or error.

The CharSequence is encoded to UTF8

Parameters:
  `data` - The data to send
  `callback` - The callback

#### send

    void send(String data,
              Charset charset,
              IoCallback callback)

Write the given String using async IO, and calls the given callback on completion or error.

Parameters:
  `data` - The buffer to end.
  `charset` - The charset to use
  `callback` - The callback

#### send

    void send(String data)

Write the given String using async IO, and ends the exchange when done

The CharSequence is encoded to UTF8

Parameters:
  `data` - The data to send

#### send

    void send(String data,
              Charset charset)

Write the given String using async IO, and ends the exchange when done

Parameters:
  `data` - The buffer to end.
  `charset` - The charset to use

#### transferFrom

    void transferFrom(FileChannel channel,
                      IoCallback callback)

Transfers all content from the specified file

Parameters:
  `channel` - the file channel to transfer
  `callback` - The callback

#### close

    void close(IoCallback callback)

Closes this sender asynchronously. The given callback is notified on completion

Parameters:
  `callback` - The callback that is notified when all data has been flushed and the channel is closed

#### close

    void close()

Closes this sender asynchronously