public final class GatedStreamSinkChannel extends Object implements org.xnio.channels.StreamSinkChannel
This channel has a gate which starts of closed. When the gate is closed writes will return 0. When the gate is opened writes will resume as normal.
| Constructor and Description | 
|---|
| GatedStreamSinkChannel(org.xnio.channels.StreamSinkChannel delegate)Construct a new instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | awaitWritable() | 
| void | awaitWritable(long time, TimeUnit timeUnit) | 
| void | close() | 
| boolean | flush() | 
| org.xnio.channels.StreamSinkChannel | getChannel()Get the underlying channel if the gate is open, else return this channel. | 
| org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> | getCloseSetter() | 
| org.xnio.XnioIoThread | getIoThread() | 
| <T> T | getOption(org.xnio.Option<T> option) | 
| org.xnio.XnioWorker | getWorker() | 
| org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> | getWriteSetter() | 
| org.xnio.XnioExecutor | getWriteThread() | 
| boolean | isGateOpen() | 
| boolean | isOpen() | 
| boolean | isWriteResumed() | 
| void | openGate()Open the gate and allow data to flow. | 
| void | resumeWrites() | 
| <T> T | setOption(org.xnio.Option<T> option, T value) | 
| void | shutdownWrites() | 
| boolean | supportsOption(org.xnio.Option<?> option) | 
| void | suspendWrites() | 
| long | transferFrom(FileChannel src, long position, long count) | 
| long | transferFrom(org.xnio.channels.StreamSourceChannel source, long count, ByteBuffer throughBuffer) | 
| void | wakeupWrites() | 
| int | write(ByteBuffer src) | 
| long | write(ByteBuffer[] srcs) | 
| long | write(ByteBuffer[] srcs, int offset, int length) | 
| int | writeFinal(ByteBuffer src) | 
| long | writeFinal(ByteBuffer[] srcs) | 
| long | writeFinal(ByteBuffer[] srcs, int offset, int length) | 
public GatedStreamSinkChannel(org.xnio.channels.StreamSinkChannel delegate)
delegate - the channel to wrappublic void openGate()
              throws IOException If the shutdownWrites() or close() method has already been called this will result it in being invoked on the delegate.
IOExceptionpublic boolean isGateOpen()
public org.xnio.XnioWorker getWorker()
getWorker in interface org.xnio.channels.CloseableChannelpublic org.xnio.XnioIoThread getIoThread()
getIoThread in interface org.xnio.channels.CloseableChannelpublic org.xnio.XnioExecutor getWriteThread()
getWriteThread in interface org.xnio.channels.SuspendableWriteChannelpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> getWriteSetter()
getWriteSetter in interface org.xnio.channels.StreamSinkChannelgetWriteSetter in interface org.xnio.channels.SuspendableWriteChannelpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSinkChannel> getCloseSetter()
getCloseSetter in interface org.xnio.channels.CloseableChannelgetCloseSetter in interface org.xnio.channels.StreamSinkChannelgetCloseSetter in interface org.xnio.channels.SuspendableWriteChannelpublic int writeFinal(ByteBuffer src) throws IOException
writeFinal in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException
writeFinal in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic long writeFinal(ByteBuffer[] srcs) throws IOException
writeFinal in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic int write(ByteBuffer src) throws IOException
write in interface WritableByteChannelIOExceptionpublic long write(ByteBuffer[] srcs) throws IOException
write in interface GatheringByteChannelIOExceptionpublic long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write in interface GatheringByteChannelIOExceptionpublic long transferFrom(FileChannel src, long position, long count) throws IOException
transferFrom in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic long transferFrom(org.xnio.channels.StreamSourceChannel source,
                         long count,
                         ByteBuffer throughBuffer)
                  throws IOException transferFrom in interface org.xnio.channels.StreamSinkChannelIOExceptionpublic boolean flush()
              throws IOException flush in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void suspendWrites()
suspendWrites in interface org.xnio.channels.SuspendableWriteChannelpublic void resumeWrites()
resumeWrites in interface org.xnio.channels.SuspendableWriteChannelpublic boolean isWriteResumed()
isWriteResumed in interface org.xnio.channels.SuspendableWriteChannelpublic void wakeupWrites()
wakeupWrites in interface org.xnio.channels.SuspendableWriteChannelpublic void shutdownWrites()
                    throws IOException shutdownWrites in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void close()
           throws IOException close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in interface org.xnio.channels.CloseableChannelclose in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void awaitWritable()
                   throws IOException awaitWritable in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic void awaitWritable(long time,
                          TimeUnit timeUnit)
                   throws IOException awaitWritable in interface org.xnio.channels.SuspendableWriteChannelIOExceptionpublic boolean isOpen()
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption in interface org.xnio.channels.Configurablepublic <T> T getOption(org.xnio.Option<T> option)
                throws IOException getOption in interface org.xnio.channels.ConfigurableIOExceptionpublic <T> T setOption(org.xnio.Option<T> option,
                       T value)
                throws IllegalArgumentException,
                       IOException setOption in interface org.xnio.channels.ConfigurableIllegalArgumentExceptionIOExceptionpublic org.xnio.channels.StreamSinkChannel getChannel()
Copyright © 2015 JBoss by Red Hat. All rights reserved.