Package org.apache.mina.common
Class TrafficMask
- java.lang.Object
-
- org.apache.mina.common.TrafficMask
-
public class TrafficMask extends java.lang.ObjectA type-safe mask that is used to control the traffic ofIoSessionwithIoSession.setTrafficMask(TrafficMask).
-
-
Field Summary
Fields Modifier and Type Field Description static TrafficMaskALLThis mask resumes both reads and writes if any of them were suspended.static TrafficMaskNONEThis mask suspends both reads and writes.static TrafficMaskREADThis mask suspends writes, and resumes reads if reads were suspended.static TrafficMaskWRITEThis mask suspends reads, and resumes writes if writes were suspended.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TrafficMaskand(TrafficMask mask)Peforms an AND operation on this mask with the specified mask and returns the result.static TrafficMaskgetInstance(int interestOps)Returns an appropriateTrafficMaskinstance from the specified interestOps.intgetInterestOps()Returns an interestOps ofSelectionKeyfor this mask.java.lang.StringgetName()Returns the name of this mask.booleanisReadable()Returns true if this mask allows a read operation.booleanisWritable()Returns true if this mask allows a write operation.TrafficMasknot()Returns a negated mask of this one.TrafficMaskor(TrafficMask mask)Peforms an OR operation on this mask with the specified mask and returns the result.java.lang.StringtoString()TrafficMaskxor(TrafficMask mask)Peforms an XOR operation on this mask with the specified mask and returns the result.
-
-
-
Field Detail
-
NONE
public static final TrafficMask NONE
This mask suspends both reads and writes.
-
READ
public static final TrafficMask READ
This mask suspends writes, and resumes reads if reads were suspended.
-
WRITE
public static final TrafficMask WRITE
This mask suspends reads, and resumes writes if writes were suspended.
-
ALL
public static final TrafficMask ALL
This mask resumes both reads and writes if any of them were suspended.
-
-
Method Detail
-
getInstance
public static TrafficMask getInstance(int interestOps)
Returns an appropriateTrafficMaskinstance from the specified interestOps.- See Also:
SelectionKey
-
getName
public java.lang.String getName()
Returns the name of this mask.
-
isReadable
public boolean isReadable()
Returns true if this mask allows a read operation.
-
isWritable
public boolean isWritable()
Returns true if this mask allows a write operation.
-
getInterestOps
public int getInterestOps()
Returns an interestOps ofSelectionKeyfor this mask.
-
and
public TrafficMask and(TrafficMask mask)
Peforms an AND operation on this mask with the specified mask and returns the result.
-
or
public TrafficMask or(TrafficMask mask)
Peforms an OR operation on this mask with the specified mask and returns the result.
-
not
public TrafficMask not()
Returns a negated mask of this one.
-
xor
public TrafficMask xor(TrafficMask mask)
Peforms an XOR operation on this mask with the specified mask and returns the result.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-