XNIO API 2.0.0.GA

org.jboss.xnio.channels
Interface ReadableMessageChannel

All Superinterfaces:
java.nio.channels.Channel, java.io.Closeable, CloseableChannel, Configurable, SuspendableReadChannel
All Known Subinterfaces:
DatagramChannel<A>, MessageChannel

public interface ReadableMessageChannel
extends SuspendableReadChannel, Configurable

A channel that can receive messages. Such a channel receives whole messages only.


Method Summary
 ChannelListener.Setter<? extends ReadableMessageChannel> getCloseSetter()
          Get the setter which can be used to change the close handler for this channel.
 ChannelListener.Setter<? extends ReadableMessageChannel> getReadSetter()
          Get the setter which can be used to change the read handler for this channel.
 int receive(java.nio.ByteBuffer buffer)
          Receive a message.
 long receive(java.nio.ByteBuffer[] buffers)
          Receive a message.
 long receive(java.nio.ByteBuffer[] buffers, int offs, int len)
          Receive a message.
 
Methods inherited from interface org.jboss.xnio.channels.SuspendableReadChannel
awaitReadable, awaitReadable, resumeReads, shutdownReads, suspendReads
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface org.jboss.xnio.channels.Configurable
getOption, setOption, supportsOption
 

Method Detail

receive

int receive(java.nio.ByteBuffer buffer)
            throws java.io.IOException
Receive a message.

Parameters:
buffer - the buffer that will hold the message
Returns:
the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition
Throws:
java.io.IOException - if an I/O error occurs

receive

long receive(java.nio.ByteBuffer[] buffers)
             throws java.io.IOException
Receive a message.

Parameters:
buffers - the buffers that will hold the message
Returns:
the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition
Throws:
java.io.IOException - if an I/O error occurs

receive

long receive(java.nio.ByteBuffer[] buffers,
             int offs,
             int len)
             throws java.io.IOException
Receive a message.

Parameters:
buffers - the buffers that will hold the message
offs - the offset into the array of buffers of the first buffer to read into
len - the number of buffers to fill
Returns:
the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition
Throws:
java.io.IOException - if an I/O error occurs

getReadSetter

ChannelListener.Setter<? extends ReadableMessageChannel> 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.

Specified by:
getReadSetter in interface SuspendableReadChannel
Returns:
the setter

getCloseSetter

ChannelListener.Setter<? extends ReadableMessageChannel> 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
Specified by:
getCloseSetter in interface SuspendableReadChannel
Returns:
the setter

XNIO API 2.0.0.GA

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