com.faunos.util.net
Enum IoState

java.lang.Object
  extended by java.lang.Enum<IoState>
      extended by com.faunos.util.net.IoState
All Implemented Interfaces:
Serializable, Comparable<IoState>

public enum IoState
extends Enum<IoState>

The various I/O states of a Handlet.

BF: Consider adding a 5th state, say DUPLEX, representing both read and write I/O state. It's not needed for the current HTTP implementation, but can be used to prefetch response handlets from pipelined client requests. It might also come in handy for rolling out a proxy server. Will revist..
--12/8/08

Author:
Babak Farhang

Enum Constant Summary
DONE
           
PROCESSING
           
READING
           
WRITING
           
 
Method Summary
 int interestOp()
          Returns the SelectionKey interest-op associated with this I/O state.
 boolean isDone()
          Tests whether this is the DONE state.
 boolean isProcessing()
          Tests whether this is the PROCESSING state.
 boolean isReading()
          Tests whether this is the READING state.
 boolean isWriting()
          Tests whether this is the WRITING state.
static IoState valueOf(String name)
          Returns the enum constant of this type with the specified name.
static IoState[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

READING

public static final IoState READING

PROCESSING

public static final IoState PROCESSING

WRITING

public static final IoState WRITING

DONE

public static final IoState DONE
Method Detail

values

public static final IoState[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(IoState c : IoState.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static IoState valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

isReading

public boolean isReading()
Tests whether this is the READING state.


isWriting

public boolean isWriting()
Tests whether this is the WRITING state.


isProcessing

public boolean isProcessing()
Tests whether this is the PROCESSING state. The processing state is not associated with any current I/O; rather, it represents some lengthy (perhaps CPU-intensive) operation.


isDone

public boolean isDone()
Tests whether this is the DONE state. The DONE state represents the completion (end) of I/O processing.


interestOp

public int interestOp()
Returns the SelectionKey interest-op associated with this I/O state. Only the READING and WRITING states return non-zero values.

See Also:
SelectionKey.OP_READ, SelectionKey.OP_WRITE


SourceForge.net Logo