|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.squawk.io.mailboxes.Envelope com.sun.squawk.io.mailboxes.ByteArrayInputStreamEnvelope
public class ByteArrayInputStreamEnvelope
A ByteArrayInputStreamEnvelope can be used to pass a byte array, or subsection of a byte array, as a ByteArrayInputStream. This is a zero-copy way (except for the envelope object itself) to send the contents of a byte array to another isolate.
The main drawback of using ByteArrayInputStreamEnvelopes instead of ByteArrayEnvelopes is that if the sender makes any changes to the byte array encapsulated by the ByteArrayInputStreamEnvelope, these changes may be visible to the receiver of the envelope.
This can avoided in applications that implement replies or awknowledgements for all sent envelopes by not re-using the original byte array until the receiver sends some reply or acknowledgment back.
Constructor Summary | |
---|---|
ByteArrayInputStreamEnvelope(byte[] array)
Create a ByteArrayEnvelope for the specified array. |
|
ByteArrayInputStreamEnvelope(byte[] array,
int offset,
int len)
Create a ByteArrayEnvelope for the subsection of the specified array. |
Method Summary | |
---|---|
Object |
getContents()
Return the contents of the envelope. |
ByteArrayInputStream |
getData()
Return the contents of the envelope, which is a ByteArrayInputStream. |
Methods inherited from class com.sun.squawk.io.mailboxes.Envelope |
---|
checkCallContext |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteArrayInputStreamEnvelope(byte[] array)
array
- the array of bytes to be sent.public ByteArrayInputStreamEnvelope(byte[] array, int offset, int len)
array
- the array of bytes to be sent.offset
- offset to the first byte in the array to be sent.len
- the number of bytes to be sent.Method Detail |
---|
public Object getContents()
getContents
in class Envelope
public ByteArrayInputStream getData()
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |