XNIO API 2.0.0.GA

org.jboss.xnio.channels
Interface SuspendableReadChannel

All Superinterfaces:
java.nio.channels.Channel, java.io.Closeable, CloseableChannel, Configurable
All Known Subinterfaces:
ConnectedStreamChannel<A>, DatagramChannel<A>, LocalChannel, MessageChannel, MultipointDatagramChannel<A>, MultipointMessageChannel<A>, MultipointReadableMessageChannel<A>, ReadableAllocatedMessageChannel, ReadableMessageChannel, SslTcpChannel, StreamChannel, StreamSourceChannel, SuspendableChannel, TcpChannel, UdpChannel

public interface SuspendableReadChannel
extends CloseableChannel

A suspendable readable channel. This type of channel is associated with a handler which can suspend and resume reads as needed.


Method Summary
 void awaitReadable()
          Block until this channel becomes readable again.
 void awaitReadable(long time, java.util.concurrent.TimeUnit timeUnit)
          Block until this channel becomes readable again, or until the timeout expires.
 ChannelListener.Setter<? extends SuspendableReadChannel> getCloseSetter()
          Get the setter which can be used to change the close handler for this channel.
 ChannelListener.Setter<? extends SuspendableReadChannel> getReadSetter()
          Get the setter which can be used to change the read handler for this channel.
 void resumeReads()
          Resume reads on this channel.
 void shutdownReads()
          Places this readable channel at "end of stream".
 void suspendReads()
          Suspend further read notifications on this channel.
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface org.jboss.xnio.channels.Configurable
getOption, setOption, supportsOption
 

Method Detail

suspendReads

void suspendReads()
Suspend further read notifications on this channel.


resumeReads

void resumeReads()
Resume reads on this channel. The read handler channel listener will be called as soon as there is data available to be read.


shutdownReads

void shutdownReads()
                   throws java.io.IOException
Places this readable channel at "end of stream". Further reads will result in EOF.

Throws:
java.io.IOException - if an I/O error occurs

awaitReadable

void awaitReadable()
                   throws java.io.IOException
Block until this channel becomes readable again. This method may return spuriously before the channel becomes readable.

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

awaitReadable

void awaitReadable(long time,
                   java.util.concurrent.TimeUnit timeUnit)
                   throws java.io.IOException
Block until this channel becomes readable again, or until the timeout expires. This method may return spuriously before the channel becomes readable or the timeout expires.

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

getReadSetter

ChannelListener.Setter<? extends SuspendableReadChannel> getReadSetter()
Get the setter which can be used to change the read handler for this channel. When the handler is called, additional notifications are automatically suspended.

Returns:
the setter
Since:
2.0

getCloseSetter

ChannelListener.Setter<? extends SuspendableReadChannel> getCloseSetter()
Get the setter which can be used to change the close handler for this channel. If the channel is already closed, then the handler will not be called.

Specified by:
getCloseSetter in interface CloseableChannel
Returns:
the setter

XNIO API 2.0.0.GA

Copyright © 2009 JBoss, a division of Red Hat, Inc.