Package org.xnio.conduits

# Interface SinkConduit

All Superinterfaces:
  `Conduit`

All Known Subinterfaces:
  `MessageSinkConduit`, `StreamSinkConduit`

All Known Implementing Classes:
  `AbstractMessageSinkConduit`, `AbstractSinkConduit`, `AbstractStreamSinkConduit`, `AbstractSynchronizedSinkConduit`, `BlockingStreamSinkConduit`, `BufferedStreamSinkConduit`, `DeflatingStreamSinkConduit`, `FixedLengthStreamSinkConduit`, `FramingMessageSinkConduit`, `MessageStreamSinkConduit`, `NullStreamSinkConduit`, `SaslUnwrappingConduit`, `SaslWrappingConduit`, `StreamSinkChannelWrappingConduit`, `SynchronizedMessageSinkConduit`, `SynchronizedStreamSinkConduit`

public interface SinkConduit extends Conduit
A conduit which is a target or output for data.

Author:
  David M. Lloyd

## Method Summary

Modifier and Type
Method
Description
`void`
`awaitWritable()`
Block until this channel becomes writable again.
`void`
`awaitWritable(long time, TimeUnit timeUnit)`
Block until this conduit becomes writable again, or until the timeout expires.
`boolean`
`flush()`
Flush out any unwritten, buffered output.
`XnioIoThread`
`getWriteThread()`
Get the write thread for this conduit.
`boolean`
`isWriteResumed()`
Determine whether write notifications are currently enabled.
`boolean`
`isWriteShutdown()`
Determine whether writes have been fully shut down on this conduit.
`void`
`resumeWrites()`
Indicate that the conduit's `WriteReadyHandler` should be invoked as soon as data can be written without blocking.
`void`
`setWriteReadyHandler(WriteReadyHandler handler)`
Set the handler which should receive readiness notifications.
`void`
`suspendWrites()`
Indicate that calling the conduit's `WriteReadyHandler` should be suspended.
`void`
`terminateWrites()`
Signal that no more write data is forthcoming.
`void`
`truncateWrites()`
Terminate writes and discard any outstanding write data.
`void`
`wakeupWrites()`
Indicate that the conduit's `WriteReadyHandler` should be invoked immediately, and then again as soon as data can be written without blocking.

### Methods inherited from interface org.xnio.conduits.Conduit

`getWorker`

## Method Details

### terminateWrites

void terminateWrites() throws IOException
Signal that no more write data is forthcoming. The conduit must be `flush()`ed before it is considered to be shut down.

Throws:
  `IOException`

### isWriteShutdown

boolean isWriteShutdown()
Determine whether writes have been fully shut down on this conduit.

Returns:
  `true` if writes are fully shut down, `false` otherwise

### resumeWrites

void resumeWrites()
Indicate that the conduit's `WriteReadyHandler` should be invoked as soon as data can be written without blocking.

### suspendWrites

void suspendWrites()
Indicate that calling the conduit's `WriteReadyHandler` should be suspended.

### wakeupWrites

void wakeupWrites()
Indicate that the conduit's `WriteReadyHandler` should be invoked immediately, and then again as soon as data can be written without blocking.

### isWriteResumed

boolean isWriteResumed()
Determine whether write notifications are currently enabled.

Returns:
  `true` if write notifications are enabled

### awaitWritable

void awaitWritable() throws IOException
Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.

Throws:
  `InterruptedIOException` - if the operation is interrupted; the thread's interrupt flag will be set as well
  `IOException` - if an I/O error occurs

### awaitWritable

void awaitWritable(long time, TimeUnit timeUnit) throws IOException
Block until this conduit becomes writable again, or until the timeout expires. This method may return spuriously before the conduit becomes writable or the timeout expires.

Parameters:
  `time` - the time to wait
  `timeUnit` - the time unit
Throws:
  `InterruptedIOException` - if the operation is interrupted; the thread's interrupt flag will be set as well
  `IOException` - if an I/O error occurs

### getWriteThread

XnioIoThread getWriteThread()
Get the write thread for this conduit.

Returns:
  the thread, or `null` if none is configured or available

### setWriteReadyHandler

void setWriteReadyHandler(WriteReadyHandler handler)
Set the handler which should receive readiness notifications. A filter may pass this invocation on to the filter it wraps, or it may substitute itself.

Parameters:
  `next` - the filter to receive readiness notifications

### truncateWrites

void truncateWrites() throws IOException
Terminate writes and discard any outstanding write data. The conduit is terminated and flushed regardless of the outcome of this method.

Throws:
  `IOException` - if channel termination failed for some reason

### flush

boolean flush() throws IOException
Flush out any unwritten, buffered output.

Returns:
  `true` if everything is flushed, `false` otherwise
Throws:
  `IOException` - if flush fails