org.tranche.configuration
Class ServerModeFlag

java.lang.Object
  extended by org.tranche.configuration.ServerModeFlag

public class ServerModeFlag
extends java.lang.Object

Simple byte flags for server mode (permissions such as read, write). Mode information applies to all clients, and must be enforced.

Note that this is a byte. Hence:

Author:
Bryan Smith - bryanesmith@gmail.com

Field Summary
static byte CAN_READ
          Flag: server data can be read by clients, but cannot write data to server.
static byte CAN_READ_WRITE
          Flag: clients can write and read data to and from server.
static byte CAN_WRITE
          Flag: clients can write data to server, but cannot read it.
static byte NONE
          Flag: clients cannot read nor write data from nor to server.
 
Constructor Summary
ServerModeFlag()
           
 
Method Summary
static boolean canRead(byte flag)
          Based on flag byte, can client read data from server?
static boolean canWrite(byte flag)
          Based on flag byte, can client write data to server?
static java.lang.String toString(byte flag)
          Convert server mode flag byte to String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAN_READ

public static final byte CAN_READ

Flag: server data can be read by clients, but cannot write data to server.

See Also:
Constant Field Values

CAN_WRITE

public static final byte CAN_WRITE

Flag: clients can write data to server, but cannot read it.

See Also:
Constant Field Values

NONE

public static final byte NONE

Flag: clients cannot read nor write data from nor to server.

See Also:
Constant Field Values

CAN_READ_WRITE

public static final byte CAN_READ_WRITE

Flag: clients can write and read data to and from server.

See Also:
Constant Field Values
Constructor Detail

ServerModeFlag

public ServerModeFlag()
Method Detail

toString

public static final java.lang.String toString(byte flag)

Convert server mode flag byte to String representation.

Parameters:
flag -
Returns:

canRead

public static boolean canRead(byte flag)

Based on flag byte, can client read data from server?

Parameters:
flag -
Returns:
Ture if and only if read bit is set in flag

canWrite

public static boolean canWrite(byte flag)

Based on flag byte, can client write data to server?

Parameters:
flag -
Returns:
True if and only if write bit is set in flag


This code is free for use both commercially and non-commercially as stated in the project's license