|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.latencybusters.lbm.sdm.LBMSDM
com.latencybusters.lbm.sdm.LBMSDMessage
public class LBMSDMessage
LBMSDMessage is the main class for managing an LBM SDM message. It heavily relies on class LBMSDMFields to collect LBMSDMField and LBMSDMArray classes in to a message. LBMSDMessage is the primary interface for applications.
Field Summary |
---|
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM |
---|
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING |
Constructor Summary | |
---|---|
LBMSDMessage()
Create an empty SDM message |
|
LBMSDMessage(LBMSDMFields args)
Create an SDM message with a predefined set of fields |
|
LBMSDMessage(LBMSDMFieldsAttribute user_attr)
Create an empty SDM message using a field set attribute |
Method Summary | |
---|---|
void |
add(LBMSDMField f)
Add a field to a message - the field set will be automatically created if needed |
LBMSDMessage |
clone()
Clone an SDM message |
int |
count()
Count the number of fields in a message |
byte[] |
data()
Get a byte buffer (array) to a raw SDM message in network order. |
LBMSDMFieldsAttribute |
get_attr()
Get the field set attributes are associated with this message A copy is returned |
LBMSDMFields |
get_fset()
Get the field set that is associated with this message |
LBMSDMField |
get(int pos)
Get a field by the index |
int |
length()
Get the raw length of the message. |
LBMSDMField |
locate(java.lang.String name)
Locate a field by name |
void |
parse(byte[] buf)
Parse a byte buffer containing a raw SDM message (as received on a socket) to fill the SDM message object. |
void |
parse(byte[] buf,
int offset)
Parse a byte buffer containing a raw SDM message (as received on a socket) to fill the SDM message object. |
void |
remove(int pos)
Remove a field by specifying the index |
void |
remove(java.lang.String name)
Remove a field by specifying the name |
void |
set(LBMSDMField newfield)
Set an SDM message field. |
void |
set(LBMSDMField newfield,
int fieldidx)
Set an SDM message field based on the message element index. |
void |
set(LBMSDMField newfield,
int fieldidx,
int arrayidx)
Set an SDM message field based on the message element index and the array index. |
void |
set(LBMSDMFields args)
Add to the SDM message a set of fields. |
boolean |
test_clone(LBMSDMessage m)
An api that is used during testing to ensure that cloned objects are truly cloned. |
java.lang.String |
toDbgString()
Dump an internal (ascii) representation of this message |
java.lang.String |
toString()
Dump a string (ascii) representation of this message |
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM |
---|
log, set_debug_level |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LBMSDMessage()
public LBMSDMessage(LBMSDMFieldsAttribute user_attr)
user_attr
- A field set attribute objectpublic LBMSDMessage(LBMSDMFields args)
args
- The set of fields to be added to the SDM messageMethod Detail |
---|
public void set(LBMSDMFields args)
args
- The set of fields to be added to the SDM messageLBMSDMFields
public void set(LBMSDMField newfield) throws LBMSDMException
newfield
- The new field
LBMSDMAddingFieldException
- when the field doesn't exist
LBMSDMException
public void set(LBMSDMField newfield, int fieldidx) throws LBMSDMException
newfield
- The new fieldfieldidx
- The field index in the message
LBMSDMAddingFieldException
- when the field doesn't exist
LBMSDMException
public void set(LBMSDMField newfield, int fieldidx, int arrayidx) throws LBMSDMException
newfield
- The new fieldfieldidx
- The field index in the messagearrayidx
- The array index in the field
LBMSDMAddingFieldException
- when the field doesn't exist
LBMSDMException
public LBMSDMFields get_fset()
public LBMSDMFieldsAttribute get_attr()
public void add(LBMSDMField f) throws LBMSDMException
f
- The LBMSDMField object to be added
LBMSDMException
public void remove(int pos)
pos
- The index of the fieldpublic void remove(java.lang.String name)
name
- The field name to be removedpublic void parse(byte[] buf, int offset) throws LBMSDMException
buf
- The byte array (buffer) containing the raw SDM message to be parsedoffset
- The index in the array where parsing should start
LBMSDMException
- if a problem occurs parsing the message buffer,
for example if the message has bad datapublic void parse(byte[] buf) throws LBMSDMException
buf
- The byte array (buffer) containing the raw SDM message to be parsed
LBMSDMException
- if a problem occurs parsing the message buffer
for example if the message has bad datapublic byte[] data() throws java.lang.IndexOutOfBoundsException, LBMSDMException
java.lang.IndexOutOfBoundsException
- if the byte buffer can not be build
LBMSDMException
- when an unexpected error occurs within LBMSDMpublic java.lang.String toDbgString()
public java.lang.String toString()
toString
in class java.lang.Object
public LBMSDMessage clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- which should not happen :-)public boolean test_clone(LBMSDMessage m) throws LBMSDMException
m
- An SDM message object to test against this object
LBMSDMException
public LBMSDMField locate(java.lang.String name)
name
- Name of field being located
public int count()
public int length() throws java.lang.IndexOutOfBoundsException, LBMSDMException
java.lang.IndexOutOfBoundsException
LBMSDMException
public LBMSDMField get(int pos)
pos
- The index of the field required
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |