org.jnetstream.protocol
Class Characteristic.BitCodec

java.lang.Object
  extended by org.jnetstream.protocol.Characteristic.BitCodec
Enclosing interface:
Characteristic

public static class Characteristic.BitCodec
extends java.lang.Object

A special utility method which can encode and decode a set of characteristics into a bitwise representation in a 32-bit unsigned integer.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
Characteristic.BitCodec()
           
 
Method Summary
static java.util.Set<? extends Characteristic> valueOf(int value)
          Decodes the unsigned uninteger into a set containing all of the various constants.
static int valueOf(java.util.Set<Characteristic> chars)
          Encodes characteristic contants into an unsigned 32-bit integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Characteristic.BitCodec

public Characteristic.BitCodec()
Method Detail

valueOf

public static java.util.Set<? extends Characteristic> valueOf(int value)
Decodes the unsigned uninteger into a set containing all of the various constants.

Parameters:
value - value with the bit encoded characteristics
Returns:
a set with the decoded constants

valueOf

public static int valueOf(java.util.Set<Characteristic> chars)
Encodes characteristic contants into an unsigned 32-bit integer. Each bit represents a particular characteristic contants.

Parameters:
chars - a set of characteristic contants to encode into unsigned integer
Returns:
unsigned 32-bit integer with the constants encoded