org.spicefactory.cinnamon.io.netconnection
Class NetConnectionEnvelope

java.lang.Object
  extended by org.spicefactory.cinnamon.io.netconnection.NetConnectionEnvelope
All Implemented Interfaces:
Serializable, Envelope

public class NetConnectionEnvelope
extends Object
implements Serializable, Envelope

Represents an AMF0 envelope that contains one or more AMF3 requests or responses.

Author:
Jens Halm
See Also:
Serialized Form

Constructor Summary
NetConnectionEnvelope()
          Creates a new envelope.
NetConnectionEnvelope(int amfVersion)
          Creates a new envelope.
 
Method Summary
 void addMessage(MessageHolder message)
          Adds a message to this envelope.
 List<MessageHolder> getMessages()
          Returns all messages contained in this envelope.
 int getVersion()
          Returns the AMF version.
 void readObject(AMFInput input, boolean request)
          Restores the content of this envelope from the specified input.
 String toString()
           
 void writeObject(AMFOutput output, boolean request)
          Writes the content of this envelope to the specified output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetConnectionEnvelope

public NetConnectionEnvelope()
Creates a new envelope.


NetConnectionEnvelope

public NetConnectionEnvelope(int amfVersion)
Creates a new envelope.

Parameters:
amfVersion - the AMF version
Method Detail

addMessage

public void addMessage(MessageHolder message)
Adds a message to this envelope.

Specified by:
addMessage in interface Envelope
Parameters:
message - the message to add to the envelope

getMessages

public List<MessageHolder> getMessages()
Returns all messages contained in this envelope.

Specified by:
getMessages in interface Envelope
Returns:
all messages contained in this envelope

getVersion

public int getVersion()
Returns the AMF version. Currently only AMF3 is supported.

Returns:
the AMF version

readObject

public void readObject(AMFInput input,
                       boolean request)
Restores the content of this envelope from the specified input.

Parameters:
input - the AMF3 data to read from
request - whether this envelope represents a request or a response

writeObject

public void writeObject(AMFOutput output,
                        boolean request)
Writes the content of this envelope to the specified output.

Parameters:
output - the output to write to
request - whether this envelope represents a request or a response

toString

public String toString()
Overrides:
toString in class Object