Top Description Methods
io.undertow.io

public Interface Sender

Known Direct Implementers
io.undertow.server.handlers.cache.ResponseCachingSender, io.undertow.io.AsyncSenderImpl, io.undertow.io.BlockingSenderImpl
Imports
java.nio.ByteBuffer, java.nio.channels.FileChannel, java.nio.charset.Charset

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

Modifier and TypeMethod and Description
public void
close(final IoCallback
The callback that is notified when all data has been flushed and the channel is closed
callback
)

Closes this sender asynchronously.

public void
close()

Closes this sender asynchronously

public void
send(final ByteBuffer
The buffer to send.
buffer
,
final IoCallback
The callback
callback
)

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

public void
send(final ByteBuffer[]
The buffers to send.
buffer
,
final IoCallback
The callback
callback
)

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

public void
send(final ByteBuffer
The buffer to send.
buffer
)

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

public void
send(final ByteBuffer[]
The buffers to send.
buffer
)

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

public void
send(final String
The data to send
data
,
final IoCallback
The callback
callback
)

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

public void
send(final String
The buffer to end.
data
,
final Charset
The charset to use
charset
,
final IoCallback
The callback
callback
)

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

public void
send(final String
The data to send
data
)

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

The CharSequence is encoded to UTF8

public void
send(final String
The buffer to end.
data
,
final Charset
The charset to use
charset
)

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

public void
transferFrom(final FileChannel
the file channel to transfer
channel
,
final IoCallback
The callback
callback
)

Transfers all content from the specified file

Method Detail

closeback to summary
public void close(final IoCallback callback)

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

Parameters
callback:IoCallback

The callback that is notified when all data has been flushed and the channel is closed

closeback to summary
public void close()

Closes this sender asynchronously

sendback to summary
public void send(final ByteBuffer buffer, final IoCallback callback)

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

Parameters
buffer:ByteBuffer

The buffer to send.

callback:IoCallback

The callback

sendback to summary
public void send(final ByteBuffer[] buffer, final IoCallback callback)

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

Parameters
buffer:ByteBuffer[]

The buffers to send.

callback:IoCallback

The callback

sendback to summary
public void send(final ByteBuffer buffer)

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

Parameters
buffer:ByteBuffer

The buffer to send.

sendback to summary
public void send(final ByteBuffer[] buffer)

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

Parameters
buffer:ByteBuffer[]

The buffers to send.

sendback to summary
public void send(final String data, final 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:String

The data to send

callback:IoCallback

The callback

sendback to summary
public void send(final String data, final Charset charset, final IoCallback callback)

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

Parameters
data:String

The buffer to end.

charset:Charset

The charset to use

callback:IoCallback

The callback

sendback to summary
public void send(final String data)

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

The CharSequence is encoded to UTF8

Parameters
data:String

The data to send

sendback to summary
public void send(final String data, final Charset charset)

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

Parameters
data:String

The buffer to end.

charset:Charset

The charset to use

transferFromback to summary
public void transferFrom(final FileChannel channel, final IoCallback callback)

Transfers all content from the specified file

Parameters
channel:FileChannel

the file channel to transfer

callback:IoCallback

The callback