org.ow2.petals.transport.platform.nio.selector
Class OutputSocketChannelContext
java.lang.Object
org.ow2.petals.transport.platform.nio.selector.AbstractSocketChannelContext
org.ow2.petals.transport.platform.nio.selector.OutputSocketChannelContext
public class OutputSocketChannelContext
- extends AbstractSocketChannelContext
The socket channel context of an output socket. It contains following
information:
- the socket channel,
- its pending writes.
- Author:
- Christophe DENEUX (Capgemini Sud)
|
Method Summary |
boolean |
offer(byte[] buffer)
Add the data to send to a queue waiting its send. |
void |
onClose(java.nio.channels.SelectionKey key)
|
void |
write(java.nio.channels.SelectionKey key)
This method is called by the NIO selector to write available data on the
socket channel. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OutputSocketChannelContext
public OutputSocketChannelContext(java.nio.channels.SocketChannel socketChannel,
NioClient nioClient)
throws java.net.SocketException
- Constructor to use on server socket channel
- Parameters:
socketChannel - The socket channel on which a context must be created.nioClient - The NIO Client agent using this output socket context
- Throws:
java.net.SocketException
offer
public final boolean offer(byte[] buffer)
- Add the data to send to a queue waiting its send.
- Parameters:
buffer - The data to send.
- Returns:
true if data have been correctly added to the queue;
false if no more space in the queue.
write
public final void write(java.nio.channels.SelectionKey key)
- This method is called by the NIO selector to write available data on the
socket channel. If needed, data are cut in several packet to be
multiplexed into the NIO selector and to use the same direct byte buffer.
- Parameters:
key -
onClose
public final void onClose(java.nio.channels.SelectionKey key)
Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.