-
- All Superinterfaces:
java.lang.AutoCloseable
,java.nio.channels.Channel
,java.io.Closeable
,CloseableChannel
,Configurable
,java.nio.channels.InterruptibleChannel
,SuspendableReadChannel
- All Known Subinterfaces:
BoundMultipointMessageChannel
,MulticastMessageChannel
,MultipointMessageChannel
public interface ReadableMultipointMessageChannel extends SuspendableReadChannel
The readable side of a multipoint message channel.
-
-
Field Summary
-
Fields inherited from interface org.xnio.channels.Configurable
EMPTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ChannelListener.Setter<? extends ReadableMultipointMessageChannel>
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.ChannelListener.Setter<? extends ReadableMultipointMessageChannel>
getReadSetter()
Get the setter which can be used to change the read listener for this channel.int
receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer buffer)
Receive a message via this channel.long
receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer[] buffers)
Receive a message.long
receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer[] buffers, int offs, int len)
Receive a message.-
Methods inherited from interface org.xnio.channels.CloseableChannel
close, getIoThread, getWorker
-
Methods inherited from interface org.xnio.channels.Configurable
getOption, setOption, supportsOption
-
Methods inherited from interface org.xnio.channels.SuspendableReadChannel
awaitReadable, awaitReadable, getReadThread, isReadResumed, resumeReads, shutdownReads, suspendReads, wakeupReads
-
-
-
-
Method Detail
-
receiveFrom
int receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer buffer) throws java.io.IOException
Receive a message via this channel. If a message is immediately available, then the datagram is written into the given buffer and the source and destination addresses (if available) read into the address buffer. If there is no message immediately available, this method will return 0.- Parameters:
addressBuffer
- the address buffer into which the source and destination addresses should be written (null
to discard that information)buffer
- the buffer into which data should be read- 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
-
receiveFrom
long receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer[] buffers) throws java.io.IOException
Receive a message. If a message is immediately available, then the datagram is written into the given buffers in a "scatter" fashion and the source and destination addresses (if available) read into the address buffer. If there is no message immediately available, this method will return 0.- Parameters:
addressBuffer
- the address buffer into which the source and destination addresses should be written (null
to discard that information)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
-
receiveFrom
long receiveFrom(SocketAddressBuffer addressBuffer, java.nio.ByteBuffer[] buffers, int offs, int len) throws java.io.IOException
Receive a message. If a message is immediately available, then the datagram is written into the given buffers in a "scatter" fashion and the source and destination addresses (if available) read into the address buffer. If there is no message immediately available, this method will return 0.- Parameters:
addressBuffer
- the address buffer into which the source and destination addresses should be written (null
to discard that information)buffers
- the buffers that will hold the messageoffs
- the offset into the array of buffers of the first buffer to read intolen
- 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 ReadableMultipointMessageChannel> getReadSetter()
Get the setter which can be used to change the read listener for this channel.- Specified by:
getReadSetter
in interfaceSuspendableReadChannel
- Returns:
- the setter
-
getCloseSetter
ChannelListener.Setter<? extends ReadableMultipointMessageChannel> getCloseSetter()
Get the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.- Specified by:
getCloseSetter
in interfaceCloseableChannel
- Specified by:
getCloseSetter
in interfaceSuspendableReadChannel
- Returns:
- the setter
-
-