Package 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
Modifier and TypeMethodDescriptionvoid
close()
Closes this sender asynchronouslyvoid
close
(IoCallback callback) Closes this sender asynchronously.void
Write the given String using async IO, and ends the exchange when donevoid
send
(String data, IoCallback callback) Write the given String using async IO, and calls the given callback on completion or error.void
Write the given String using async IO, and ends the exchange when donevoid
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
(ByteBuffer buffer) Write the given buffer using async IO, and ends the exchange when donevoid
send
(ByteBuffer[] buffer) Write the given buffers using async IO, and ends the exchange when donevoid
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
transferFrom
(FileChannel channel, IoCallback callback) Transfers all content from the specified file
-
Method Details
-
send
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
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
Write the given buffer using async IO, and ends the exchange when done- Parameters:
buffer
- The buffer to send.
-
send
Write the given buffers using async IO, and ends the exchange when done- Parameters:
buffer
- The buffers to send.
-
send
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 sendcallback
- The callback
-
send
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 usecallback
- The callback
-
send
Write the given String using async IO, and ends the exchange when doneThe CharSequence is encoded to UTF8
- Parameters:
data
- The data to send
-
send
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
Transfers all content from the specified file- Parameters:
channel
- the file channel to transfercallback
- The callback
-
close
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
-