com.monoserv.interfaces
Interface IModuleData


public interface IModuleData


Field Summary
static int FORMAT_BINARY
          A flag indicating binary data (so when using the data, you should use the getDataBinary())
static int FORMAT_STRING_UTF8
          A flag value indicating string data encoded using UTF-8 (when when using the data, you should use getDataString())
 
Method Summary
 byte[] getDataBinary()
          Returns the data in a binary format.
 int getDataFormat()
          This returns one of the FORMAT_* variables to determine what format the data is actually in.
 java.lang.String getDataString()
          Returns the data in a string format (independant of encoding).
 boolean hasData()
          Returns true if the module contains any valid data, false otherwise.
 void readData(java.io.InputStream sock)
          Allows the object to read in the data from the socket stream directly.
 

Field Detail

FORMAT_BINARY

static final int FORMAT_BINARY
A flag indicating binary data (so when using the data, you should use the getDataBinary())

See Also:
getDataBinary(), Constant Field Values

FORMAT_STRING_UTF8

static final int FORMAT_STRING_UTF8
A flag value indicating string data encoded using UTF-8 (when when using the data, you should use getDataString())

See Also:
getDataString(), Constant Field Values
Method Detail

readData

void readData(java.io.InputStream sock)
              throws java.lang.RuntimeException
Allows the object to read in the data from the socket stream directly. NOTE: This is only called to once to setup the data.

Parameters:
sock - The socket input stream to read the input from.
Throws:
java.lang.RuntimeException - If something goes wrong.

getDataBinary

byte[] getDataBinary()
Returns the data in a binary format.

Returns:
byte[] An array of bytes representing the data

getDataString

java.lang.String getDataString()
Returns the data in a string format (independant of encoding).

Returns:
String A string representation of the data

hasData

boolean hasData()
Returns true if the module contains any valid data, false otherwise. This is left up to the module to determine what is valid and what is not.

Returns:
boolean True if the module contains data, false otherwise.

getDataFormat

int getDataFormat()
This returns one of the FORMAT_* variables to determine what format the data is actually in.

Parameters:
int - An integer representing the data format in the module.