org.mobicents.media.server.impl.resource.zap
Class Selector

java.lang.Object
  extended by org.mobicents.media.server.impl.resource.zap.Selector
All Implemented Interfaces:
org.mobicents.protocols.stream.api.StreamSelector

public class Selector
extends java.lang.Object
implements org.mobicents.protocols.stream.api.StreamSelector


Field Summary
static int READ
           
static int WRITE
           
 
Fields inherited from interface org.mobicents.protocols.stream.api.StreamSelector
OP_READ, OP_WRITE
 
Constructor Summary
Selector()
           
 
Method Summary
 void close()
           
 int doPoll(int[] fds, int key, int timeout)
          Delegates select call to unix poll function.
 void doRegister(int fd)
          Registers pipe for polling.
 void doUnregister(int fd)
          Unregisters pipe from polling.
 int getOperations()
           
 java.util.Collection<org.mobicents.protocols.stream.api.Stream> getRegisteredStreams()
           
 boolean isClosed()
           
 boolean isReadOperation()
           
 boolean isWriteOperation()
           
 org.mobicents.protocols.stream.api.SelectorKey register(Channel channel)
          Register channel with this selector.
 java.util.Collection<org.mobicents.protocols.stream.api.SelectorKey> selectNow(int ops, int timeout)
           
 void setOperation(int v)
           
 void unregister(Channel channel)
          Unregister channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ

public static final int READ
See Also:
Constant Field Values

WRITE

public static final int WRITE
See Also:
Constant Field Values
Constructor Detail

Selector

public Selector()
Method Detail

register

public org.mobicents.protocols.stream.api.SelectorKey register(Channel channel)
Register channel with this selector.

Parameters:
channel - the channel to register.

unregister

public void unregister(Channel channel)
Unregister channel.

Parameters:
channel - the channel to unregister.

doRegister

public void doRegister(int fd)
Registers pipe for polling.

Parameters:
fd - the file descriptor.

doUnregister

public void doUnregister(int fd)
Unregisters pipe from polling.

Parameters:
fd - the file descriptor.

doPoll

public int doPoll(int[] fds,
                  int key,
                  int timeout)
Delegates select call to unix poll function.

Parameters:
fds - the list of file descriptors.
key - selection key.
Returns:
the number of selected channels.

selectNow

public java.util.Collection<org.mobicents.protocols.stream.api.SelectorKey> selectNow(int ops,
                                                                                      int timeout)
                                                                               throws java.io.IOException
Specified by:
selectNow in interface org.mobicents.protocols.stream.api.StreamSelector
Throws:
java.io.IOException

setOperation

public void setOperation(int v)

getOperations

public int getOperations()

isReadOperation

public boolean isReadOperation()

isWriteOperation

public boolean isWriteOperation()

isClosed

public boolean isClosed()
Specified by:
isClosed in interface org.mobicents.protocols.stream.api.StreamSelector

close

public void close()
Specified by:
close in interface org.mobicents.protocols.stream.api.StreamSelector

getRegisteredStreams

public java.util.Collection<org.mobicents.protocols.stream.api.Stream> getRegisteredStreams()
Specified by:
getRegisteredStreams in interface org.mobicents.protocols.stream.api.StreamSelector


Copyright © 2010. All Rights Reserved.