public final class GatedStreamSourceChannel extends Object implements org.xnio.channels.StreamSourceChannel
This channel has a gate which starts of closed. When the gate is closed reads will return 0. When the gate is opened reads will resume as normal.
| Constructor and Description | 
|---|
GatedStreamSourceChannel(org.xnio.channels.StreamSourceChannel delegate) Construct a new instance.   |  
| Modifier and Type | Method and Description | 
|---|---|
void |  awaitReadable()  |  
void |  awaitReadable(long time, TimeUnit timeUnit)  |  
void |  close()  |  
org.xnio.channels.StreamSourceChannel |  getChannel() Get the underlying channel if the gate is open, else return this channel.   |  
org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSourceChannel> |  getCloseSetter()  |  
org.xnio.XnioIoThread |  getIoThread()  |  
<T> T |  getOption(org.xnio.Option<T> option)  |  
org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSourceChannel> |  getReadSetter()  |  
org.xnio.XnioExecutor |  getReadThread()  |  
org.xnio.XnioWorker |  getWorker()  |  
boolean |  isGateOpen()  |  
boolean |  isOpen()  |  
boolean |  isReadResumed()  |  
void |  openGate() Open the gate and allow data to flow.   |  
int |  read(ByteBuffer dst)  |  
long |  read(ByteBuffer[] dsts)  |  
long |  read(ByteBuffer[] dsts, int offset, int length)  |  
void |  resumeReads()  |  
<T> T |  setOption(org.xnio.Option<T> option, T value)  |  
void |  shutdownReads()  |  
boolean |  supportsOption(org.xnio.Option<?> option)  |  
void |  suspendReads()  |  
long |  transferTo(long count, ByteBuffer throughBuffer, org.xnio.channels.StreamSinkChannel target)  |  
long |  transferTo(long position, long count, FileChannel target)  |  
void |  wakeupReads()  |  
public GatedStreamSourceChannel(org.xnio.channels.StreamSourceChannel delegate)
delegate - the channel to wrappublic void openGate()
              throws IOException If the shutdownReads() 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 long transferTo(long position,
                       long count,
                       FileChannel target)
                throws IOException transferTo in interface org.xnio.channels.StreamSourceChannelIOExceptionpublic long transferTo(long count,
                       ByteBuffer throughBuffer,
                       org.xnio.channels.StreamSinkChannel target)
                throws IOException transferTo in interface org.xnio.channels.StreamSourceChannelIOExceptionpublic long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read in interface ScatteringByteChannelIOExceptionpublic long read(ByteBuffer[] dsts) throws IOException
read in interface ScatteringByteChannelIOExceptionpublic int read(ByteBuffer dst) throws IOException
read in interface ReadableByteChannelIOExceptionpublic void suspendReads()
suspendReads in interface org.xnio.channels.SuspendableReadChannelpublic void resumeReads()
resumeReads in interface org.xnio.channels.SuspendableReadChannelpublic boolean isReadResumed()
isReadResumed in interface org.xnio.channels.SuspendableReadChannelpublic void wakeupReads()
wakeupReads in interface org.xnio.channels.SuspendableReadChannelpublic void shutdownReads()
                   throws IOException shutdownReads in interface org.xnio.channels.SuspendableReadChannelIOExceptionpublic void awaitReadable()
                   throws IOException awaitReadable in interface org.xnio.channels.SuspendableReadChannelIOExceptionpublic void awaitReadable(long time,
                          TimeUnit timeUnit)
                   throws IOException awaitReadable in interface org.xnio.channels.SuspendableReadChannelIOExceptionpublic org.xnio.XnioExecutor getReadThread()
getReadThread in interface org.xnio.channels.SuspendableReadChannelpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSourceChannel> getReadSetter()
getReadSetter in interface org.xnio.channels.StreamSourceChannelgetReadSetter in interface org.xnio.channels.SuspendableReadChannelpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.StreamSourceChannel> getCloseSetter()
getCloseSetter in interface org.xnio.channels.CloseableChannelgetCloseSetter in interface org.xnio.channels.StreamSourceChannelgetCloseSetter in interface org.xnio.channels.SuspendableReadChannelpublic void close()
           throws IOException close in interface Closeableclose in interface AutoCloseableclose in interface Channelclose in interface InterruptibleChannelclose in interface org.xnio.channels.CloseableChannelIOExceptionpublic 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.StreamSourceChannel getChannel()
Copyright © 2015 JBoss by Red Hat. All rights reserved.