org.ow2.petals.transport.platform.nio.selector
Class OutputSocketChannelContext

java.lang.Object
  extended by org.ow2.petals.transport.platform.nio.selector.AbstractSocketChannelContext
      extended by 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:

Author:
Christophe DENEUX (Capgemini Sud)

Field Summary
 
Fields inherited from class org.ow2.petals.transport.platform.nio.selector.AbstractSocketChannelContext
directBuffer, INTEGER_SIZE_BYTE, isIOPending, msgExRemainingBytes, socketChannel
 
Constructor Summary
OutputSocketChannelContext(java.nio.channels.SocketChannel socketChannel, NioClient nioClient)
          Constructor to use on server socket channel
 
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
 

Constructor Detail

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
Method Detail

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.