SunSPOT API V3.0


com.sun.squawk.io.mailboxes
Class Envelope

java.lang.Object
  extended by com.sun.squawk.io.mailboxes.Envelope
Direct Known Subclasses:
ByteArrayEnvelope, ByteArrayInputStreamEnvelope, ObjectEnvelope, ReplyEnvelope, RequestEnvelope

public abstract class Envelope
extends Object

Abstract class for messages passed through Channels.

The system defines several kinds of envelopes, including ObjectEnvelopes and ByteArrayEnvelopes.

Note that the conntents of the envelope should only be looked at by the receiver, or inter-isolate pointers could be created. The getContents() method enforces this.


Constructor Summary
Envelope()
           
 
Method Summary
protected  void checkCallContext()
          Check that this envelope has been sent, and that the caller's isolate is the receiver of the envelope.
abstract  Object getContents()
          Return the contents of the envelope.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Envelope

public Envelope()
Method Detail

checkCallContext

protected void checkCallContext()
                         throws IllegalStateException
Check that this envelope has been sent, and that the caller's isolate is the receiver of the envelope. This should be called by all implementations of getContents().

Throws:
IllegalStateException - if the conditions are not met.

getContents

public abstract Object getContents()
Return the contents of the envelope. This should only be called by the receiver of the envelope. All implementations should call checkCallContext.

Returns:
the contents of the envelope
Throws:
IllegalStateException - if called before the envelopesent, or called by the sender.

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.