com.opera.core.systems.util
Class SocketMonitor

java.lang.Object
  extended by com.opera.core.systems.util.SocketMonitor

public class SocketMonitor
extends java.lang.Object

This will monitor any selectable channel, such as a SocketChannel or ServerSocketChannel and fire canWrite() or canRead() events when such events are detected by poll().

Author:
Jan Vidar Krey (janv@opera.com)

Constructor Summary
SocketMonitor()
           
 
Method Summary
 boolean add(java.nio.channels.SelectableChannel channel, SocketListener listener, int selectMask)
           
protected  void applyChanges()
           
 boolean modify(java.nio.channels.SelectableChannel channel, SocketListener listener, int selectMask)
           
 boolean poll()
           
 boolean poll(long ms)
           
protected  boolean pollSockets(long ms)
           
protected  void processSelectionKey(java.nio.channels.SelectionKey key)
           
 void remove(java.nio.channels.SelectableChannel channel)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketMonitor

public SocketMonitor()
Method Detail

add

public boolean add(java.nio.channels.SelectableChannel channel,
                   SocketListener listener,
                   int selectMask)

modify

public boolean modify(java.nio.channels.SelectableChannel channel,
                      SocketListener listener,
                      int selectMask)

remove

public void remove(java.nio.channels.SelectableChannel channel)

stop

public void stop()

poll

public boolean poll()

poll

public boolean poll(long ms)

pollSockets

protected boolean pollSockets(long ms)

applyChanges

protected void applyChanges()

processSelectionKey

protected void processSelectionKey(java.nio.channels.SelectionKey key)
                            throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.