Class agent.util.Message
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class agent.util.Message

java.lang.Object
   |
   +----agent.util.Message

public class Message
extends Object
An abstract class for the messages that AgentServers exchange with each other and with AgentLaunchers. Provides a couple of utility functions to aid in message construction.

Variable Index

 o PREFIX_SIZE
 o command
 o msg

Method Index

 o ZeroPadToLength(int, int)
All field and message length indicators are sent as zero-padded ascii integers.
 o createMessage()
Message senders call this function to force the construction of an actual message within the msg instance variable.
 o getMessageBytes()
Return a lump of bytes that is a valid message of this type.
 o makePrefix(String, int, int)
Make a string that is a valid field prefix in the format: FieldName Length of length

Variables

 o command
  protected byte command[]
 o msg
  protected byte msg[]
 o PREFIX_SIZE
  public final static int PREFIX_SIZE

Methods

 o createMessage
  public abstract void createMessage()
Message senders call this function to force the construction of an actual message within the msg instance variable. Implementors MAY put message creation into the constructor if they wish, and leave createMessage as an empty method. Current implementations put all message creation code here.
 o makePrefix
  public String makePrefix(String prefix,
                           int fieldlen,
                           int lensize)
Make a string that is a valid field prefix in the format: FieldName Length of length
Returns:
String String representation of the field prefix. Use String.getBytes on this String and resulting bytes go straight into the message right before the field data.
 o ZeroPadToLength
  public String ZeroPadToLength(int num,
                                int length)
All field and message length indicators are sent as zero-padded ascii integers. This turns the supplied number into a string and zero pads it to the specified length.
Parameters:
int - the number that needs to be converted to a string
Returns:
String
 o getMessageBytes
  public byte[] getMessageBytes()
Return a lump of bytes that is a valid message of this type. Depends on createMessage to fill in the instance variable msg.
Returns:
A lump of message bytes, suitable for transmission.

All Packages  Class Hierarchy  This Package  Previous  Next  Index