Package org.xnio.conduits

# Class AbstractSinkConduit<D extends SinkConduit>

java.lang.Object
org.xnio.conduits.AbstractConduit<D>
org.xnio.conduits.AbstractSinkConduit<D>

All Implemented Interfaces:
  `Conduit`, `SinkConduit`

Direct Known Subclasses:
  `AbstractMessageSinkConduit`, `AbstractStreamSinkConduit`, `FramingMessageSinkConduit`, `MessageStreamSinkConduit`

public abstract class AbstractSinkConduit<D extends SinkConduit> extends AbstractConduit<D> implements SinkConduit
An abstract base class for filtering output conduits.

Author:
  David M. Lloyd

## Field Summary

### Fields inherited from class org.xnio.conduits.AbstractConduit

`next`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractSinkConduit(D next)`
Construct a new instance.

## 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 class org.xnio.conduits.AbstractConduit

`getWorker`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

`getWorker`

## Constructor Details

### AbstractSinkConduit

protected AbstractSinkConduit(D next)
Construct a new instance.

Parameters:
  `next` - the delegate conduit to set

## Method Details

### terminateWrites

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

Specified by:
  `terminateWrites` in interface `SinkConduit`
Throws:
  `IOException`

### isWriteShutdown

public boolean isWriteShutdown()
Description copied from interface: `SinkConduit`
Determine whether writes have been fully shut down on this conduit.

Specified by:
  `isWriteShutdown` in interface `SinkConduit`
Returns:
  `true` if writes are fully shut down, `false` otherwise

### resumeWrites

public void resumeWrites()
Description copied from interface: `SinkConduit`
Indicate that the conduit's `WriteReadyHandler` should be invoked as soon as data can be written without blocking.

Specified by:
  `resumeWrites` in interface `SinkConduit`

### suspendWrites

public void suspendWrites()
Description copied from interface: `SinkConduit`
Indicate that calling the conduit's `WriteReadyHandler` should be suspended.

Specified by:
  `suspendWrites` in interface `SinkConduit`

### wakeupWrites

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

Specified by:
  `wakeupWrites` in interface `SinkConduit`

### isWriteResumed

public boolean isWriteResumed()
Description copied from interface: `SinkConduit`
Determine whether write notifications are currently enabled.

Specified by:
  `isWriteResumed` in interface `SinkConduit`
Returns:
  `true` if write notifications are enabled

### awaitWritable

public void awaitWritable() throws IOException
Description copied from interface: `SinkConduit`
Block until this channel becomes writable again. This method may return spuriously before the channel becomes writable.

Specified by:
  `awaitWritable` in interface `SinkConduit`
Throws:
  `IOException` - if an I/O error occurs

### awaitWritable

public void awaitWritable(long time, TimeUnit timeUnit) throws IOException
Description copied from interface: `SinkConduit`
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.

Specified by:
  `awaitWritable` in interface `SinkConduit`
Parameters:
  `time` - the time to wait
  `timeUnit` - the time unit
Throws:
  `IOException` - if an I/O error occurs

### getWriteThread

public XnioIoThread getWriteThread()
Description copied from interface: `SinkConduit`
Get the write thread for this conduit.

Specified by:
  `getWriteThread` in interface `SinkConduit`
Returns:
  the thread, or `null` if none is configured or available

### setWriteReadyHandler

public void setWriteReadyHandler(WriteReadyHandler handler)
Description copied from interface: `SinkConduit`
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.

Specified by:
  `setWriteReadyHandler` in interface `SinkConduit`

### truncateWrites

public void truncateWrites() throws IOException
Description copied from interface: `SinkConduit`
Terminate writes and discard any outstanding write data. The conduit is terminated and flushed regardless of the outcome of this method.

Specified by:
  `truncateWrites` in interface `SinkConduit`
Throws:
  `IOException` - if channel termination failed for some reason

### flush

public boolean flush() throws IOException
Description copied from interface: `SinkConduit`
Flush out any unwritten, buffered output.

Specified by:
  `flush` in interface `SinkConduit`
Returns:
  `true` if everything is flushed, `false` otherwise
Throws:
  `IOException` - if flush fails