All Packages Class Hierarchy This Package Previous Next Index
Class iBus.MessageEvent
java.lang.Object
|
+----iBus.Event
|
+----iBus.MessageEvent
- public class MessageEvent
- extends Event
A Message represents a low level iBus network message. Typically,
a iBus posting is marshaled into a byte array and fragmented.
The fragments are then packed into ``Message'' objects and passed
down the stack.
On the reveiver's site, the bottommost protocol object listents
for iBus network messages. When a message is received, a ``Message''
object is created for it and passed up the stack.
-
tPullReply
- Pull reply message type
-
tPullRequest
- Pull request message type
-
tPush
- Push message type
-
MessageEvent()
- Create an empty message object.
-
MessageEvent(iBusURL, Stack)
- Create a message object for the given channel and data.
-
MessageEvent(MessageEvent)
- Create a message by copying the header information from another message.
-
MessageEvent(Stack)
- Create an empty message object.
-
getEvent()
-
Return the event encapsulated in this message
-
getHeaderSize()
- Return the size of the message header
-
getMsgType()
- Get the message type.
-
getSeqNum()
-
Return the sequence number of the message
-
id()
- Returns the identifier of this type of event.
-
inData()
- Returns the byte array holding the incoming data.
-
inSize()
- Return the size of the input data in this message
-
inStream()
- Returns the message input data stream
-
outData()
- Returns the byte array holding the outgoing data.
-
outSize()
- Return the size of the output data in this message
-
outStream()
- Returns the message output data stream.
-
pack()
- Write the message into the message's output data stream.
-
setEvent(Event)
- set the event that is to be packed into the message.
-
setMsgType(int)
- Set the message type to push, pull request, or pull reply:
-
setSeqNum(long)
- Set the sequence number of the message.
-
unpack(byte[], int)
- Read the message from a byte array.
tPush
public static final int tPush
- Push message type
tPullRequest
public static final int tPullRequest
- Pull request message type
tPullReply
public static final int tPullReply
- Pull reply message type
MessageEvent
public MessageEvent(Stack stack)
- Create an empty message object. This constructor is typically used
by the bottommost object to create a message that is passed up the
stack.
- Parameters:
- stack - the protocol stack that creates the message
MessageEvent
public MessageEvent()
- Create an empty message object. This constructor is used
outside the scope of a stack.
MessageEvent
public MessageEvent(iBusURL channel,
Stack stack)
- Create a message object for the given channel and data. This
constructor is typically used by the API object to create a message
that is passed down the stack.
- Parameters:
- channel - the channel the message is sent to
- stack - the protocol stack that creates the message
MessageEvent
public MessageEvent(MessageEvent msg)
- Create a message by copying the header information from another message.
This constructor is typically used by protocol objects such as
FRAG that need to duplicate message header information.
- Parameters:
- msg - the MessageEvent object to copy header information from:
id
public int id()
- Returns the identifier of this type of event.
- Returns:
- the identifier of this type of event
- Overrides:
- id in class Event
outStream
public ObjectOutputStream outStream()
- Returns the message output data stream. outStream increments an
internal counter that is used to keep track of which chunk in the
message data was written by a particular object. Hence, a protocol
object may call outStream at most once.
- Returns:
- the message output data stream
outData
public byte[] outData()
- Returns the byte array holding the outgoing data.
- Returns:
- the byte array holding the outgoing data
outSize
public int outSize()
- Return the size of the output data in this message
- Returns:
- the size of the output data in this message
getHeaderSize
public int getHeaderSize()
- Return the size of the message header
- Returns:
- the size of the message header
inStream
public ObjectInputStream inStream()
- Returns the message input data stream
- Returns:
- the message input data stream
inData
public byte[] inData()
- Returns the byte array holding the incoming data.
- Returns:
- the byte array holding the incoming data
inSize
public int inSize()
- Return the size of the input data in this message
- Returns:
- the size of the input data in this message
getSeqNum
public long getSeqNum()
- Return the sequence number of the message
- Returns:
- the sequence number of the message
setSeqNum
public void setSeqNum(long s)
- Set the sequence number of the message.
- Parameters:
- s - the sequence number
setMsgType
public void setMsgType(int mt)
- Set the message type to push, pull request, or pull reply:
- Parameters:
- mt - one of tPush, tPullRequest, tPullReply
getMsgType
public int getMsgType()
- Get the message type.
- Returns:
- the message type (one of tPush, tPullRequest, tPullReply);
getEvent
public Event getEvent()
- Return the event encapsulated in this message
- Returns:
- the the event encapsulated in this message
setEvent
public void setEvent(Event event)
- set the event that is to be packed into the message.
- Parameters:
- event - that is to be packed into the message
pack
public synchronized void pack() throws IOException
- Write the message into the message's output data stream.
- Throws: IOException
- on IO errors
unpack
public synchronized void unpack(byte inData[],
int len) throws IOException, ClassNotFoundException
- Read the message from a byte array.
- Parameters:
- inData - the byte array holding the marshaled message data.
MessageEvent assumes ownership of that memory area.
- len - the length of inData
- Throws: IOException
- on IO errors
- Throws: ClassNotFoundException
- if an unknown class is
deserialized
All Packages Class Hierarchy This Package Previous Next Index