java.lang.isolate
Class IsolateMessage

java.lang.Object
  |
  +--java.lang.isolate.IsolateMessage

public class IsolateMessage
extends Object

An IsolateMessage wraps the various types that can be sent through a Link, or on an isolate start invocation or for redirecting an isolate's "standard" I/O.

IsolateMessages are immutable and may be sent on multiple links simultaneously or serially. Many of the various objects that can be referenced from an IsolateMessage are not immutable, and changes to those objects which are visible before the message is sent will be reflected in the message which is transferred across the link.

An IsolateMessageVisitor can be used to dynamically determine the contents of an IsolateMessage.

The null reference cannot be sent via an IsolateMessage.

Since:
1.5

Field Summary
static java.lang.isolate.IsolateMessage EMPTY_MESSAGE
          The empty message.
 
Method Summary
 void acceptVisitor(java.lang.isolate.IsolateMessageVisitor visitor)
          Gets the content of this message via the given message visitor.
 boolean equals(Object obj)
          Tests this IsolateMessage for equality with the given object.
 byte[] getByteArray()
          Gets a reference to the byte array wrapped in this message.
 ByteBuffer getByteBuffer()
          Gets a reference to the ByteBuffer object wrapped in this message.
 java.lang.isolate.IsolateMessage[] getComposite()
          Copies the IsolateMessages wrapped in this message to an array.
 DatagramChannel getDatagramChannel()
          Gets a reference to the DatagramChannel wrapped in this message.
 DatagramSocket getDatagramSocket()
          Gets a reference to the DatagramSocket wrapped in this message.
 FileChannel getFileChannel()
          Gets a reference to the FileChannel wrapped in this message.
 FileInputStream getFileInputStream()
          Gets a reference to the FileInputStream wrapped in this message.
 FileOutputStream getFileOutputStream()
          Gets a reference to the FileOutputStream wrapped in this message.
 java.lang.isolate.Isolate getIsolate()
          Gets a reference to the Isolate object wrapped in this message.
 java.lang.isolate.IsolateEvent getIsolateEvent()
          Gets a reference to the IsolateEvent wrapped in this message.
 java.lang.isolate.Link getLink()
          Gets a reference to the Link object wrapped in this message.
 Pipe.SinkChannel getPipeSinkChannel()
          Gets a reference to the Pipe.SinkChannel wrapped in this message.
 Pipe.SourceChannel getPipeSourceChannel()
          Gets a reference to the Pipe.SourceChannel wrapped in this message.
 Object getSerializable()
          Gets a reference to the object wrapped in this message.
 ServerSocket getServerSocket()
          Gets a reference to the ServerSocket wrapped in this message.
 ServerSocketChannel getServerSocketChannel()
          Gets a reference to the ServerSocketChannel wrapped in this message.
 Socket getSocket()
          Gets a reference to the Socket wrapped in this message.
 SocketChannel getSocketChannel()
          Gets a reference to the SocketChannel wrapped in this message.
 String getString()
          Gets a reference to the String wrapped in this message.
static java.lang.isolate.IsolateMessage newByteArrayMessage(byte[] b)
          Creates an IsolateMessage for copying the given byte array across a Link.
static java.lang.isolate.IsolateMessage newByteBufferMessage(ByteBuffer b)
          Creates an IsolateMessage for copying the given ByteBuffer across a Link.
static java.lang.isolate.IsolateMessage newCompositeMessage(java.lang.isolate.IsolateMessage[] messages)
          Creates an IsolateMessage for sending the given IsolateMessages across a Link atomically.
static java.lang.isolate.IsolateMessage newDatagramChannelMessage(DatagramChannel d)
          Creates an IsolateMessage for sending the given DatagramChannel across a Link.
static java.lang.isolate.IsolateMessage newDatagramSocketMessage(DatagramSocket s)
          Creates an IsolateMessage for sending the given DatagramSocket across a Link.
static java.lang.isolate.IsolateMessage newFileChannelMessage(FileChannel f)
          Creates an IsolateMessage for sending the given FileChannel across a Link.
static java.lang.isolate.IsolateMessage newFileInputStreamMessage(FileInputStream s)
          Creates an IsolateMessage for sending the given FileInputStream across a Link.
static java.lang.isolate.IsolateMessage newFileOutputStreamMessage(FileOutputStream s)
          Creates an IsolateMessage for sending the given FileOutputStream across a Link.
static java.lang.isolate.IsolateMessage newIsolateEventMessage(java.lang.isolate.IsolateEvent ie)
          Creates an IsolateMessage for sending the given IsolateEvent across a Link.
static java.lang.isolate.IsolateMessage newIsolateMessage(java.lang.isolate.Isolate i)
          Creates an IsolateMessage for sending the given Isolate instance Link.
static java.lang.isolate.IsolateMessage newLinkMessage(java.lang.isolate.Link l)
          Creates an IsolateMessage for sending the given link handle on a Link.
static java.lang.isolate.IsolateMessage newPipeSinkChannelMessage(Pipe.SinkChannel ps)
          Creates an IsolateMessage for sending the given Pipe.SinkChannel across a Link.
static java.lang.isolate.IsolateMessage newPipeSourceChannelMessage(Pipe.SourceChannel ps)
          Creates an IsolateMessage for sending the given Pipe.SourceChannel across a Link.
static java.lang.isolate.IsolateMessage newSerializableMessage(Object o)
          Creates an IsolateMessage for sending the given serializable object across a Link.
static java.lang.isolate.IsolateMessage newServerSocketChannelMessage(ServerSocketChannel s)
          Creates an IsolateMessage for sending the given ServerSocketChannel across a Link.
static java.lang.isolate.IsolateMessage newServerSocketMessage(ServerSocket s)
          Creates an IsolateMessage for sending the given ServerSocket across a Link.
static java.lang.isolate.IsolateMessage newSocketChannelMessage(SocketChannel s)
          Creates an IsolateMessage for sending the given SocketChannel across a Link.
static java.lang.isolate.IsolateMessage newSocketMessage(Socket s)
          Creates an IsolateMessage for sending the given Socket across a Link.
static java.lang.isolate.IsolateMessage newStringMessage(String s)
          Creates an IsolateMessage for sending the given String across a Link.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_MESSAGE

public static final java.lang.isolate.IsolateMessage EMPTY_MESSAGE
The empty message. This message is intended to be used in place of null, as null cannot be sent across a link or included in a composite message.

The empty message has no contents. All of the "get" operations will throw an IllegalStateException when invoked on the empty message.

There is only once instance of the empty message, so == may be used to compare a message to the empty message.

Method Detail

newIsolateMessage

public static java.lang.isolate.IsolateMessage newIsolateMessage(java.lang.isolate.Isolate i)
Creates an IsolateMessage for sending the given Isolate instance Link. If the given isolate has not been started an IllegalStateException will be thrown.

Parameters:
i - the Isolate to wrap in an IsolateMessage
Returns:
a new IsolateMessage that wraps the given Isolate object
Throws:
NullPointerException - if i is null
IllegalStateException - if the given isolate has not been started
See Also:
Link.send(IsolateMessage), getIsolate()

newLinkMessage

public static java.lang.isolate.IsolateMessage newLinkMessage(java.lang.isolate.Link l)
Creates an IsolateMessage for sending the given link handle on a Link.

Parameters:
l - the Link to wrap in an IsolateMessage
Returns:
a new IsolateMessage that wraps the given link
Throws:
NullPointerException - if l is null
See Also:
Link.send(IsolateMessage), getLink()

newByteBufferMessage

public static java.lang.isolate.IsolateMessage newByteBufferMessage(ByteBuffer b)
Creates an IsolateMessage for copying the given ByteBuffer across a Link.

The entire capacity of the ByteBuffer contents will be copied into the receiver isolate. The receiver's ByteBuffer will have the same Buffer.capacity(), Buffer.mark(), Buffer.limit(), and Buffer.position() as the given ByteBuffer.

If the contents of the given ByteBuffer (or its underlying array) are changed after the IsolateMessage is created, such changes will be reflected in the ByteBuffer sent to a receiver. However, once a ByteBuffer has been sent to a receiver, changes in the source buffer will not be reflected in the receiver's buffer.

Parameters:
b - the ByteBuffer to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given ByteBuffer
Throws:
NullPointerException - if b is null
See Also:
Link.send(IsolateMessage), getByteBuffer()
This API element may not be present in some J2ME profiles.

newByteArrayMessage

public static java.lang.isolate.IsolateMessage newByteArrayMessage(byte[] b)
Creates an IsolateMessage for copying the given byte array across a Link.

If the contents of the given byte array are changed after the IsolateMessage is created, such changes will be reflected in the byte array given to a receiver. However, once a byte array has been sent to a receiver, changes in the source array will not be reflected in the receiver's array.

Parameters:
b - the byte array to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given byte array
Throws:
NullPointerException - if b is null
See Also:
Link.send(IsolateMessage), getByteArray()

newStringMessage

public static java.lang.isolate.IsolateMessage newStringMessage(String s)
Creates an IsolateMessage for sending the given String across a Link.

Parameters:
s - the byte array to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given String
Throws:
NullPointerException - if s is null
See Also:
Link.send(IsolateMessage), getString()

newSocketMessage

public static java.lang.isolate.IsolateMessage newSocketMessage(Socket s)
Creates an IsolateMessage for sending the given Socket across a Link.

Only java.net.Socket objects created by the platform default socket implementation are supported by this method. Passing an unsupported Socket instance to this method will result in an IllegalArgumentException.

Parameters:
s - the Socket to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given Socket
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getSocket()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

newServerSocketMessage

public static java.lang.isolate.IsolateMessage newServerSocketMessage(ServerSocket s)
Creates an IsolateMessage for sending the given ServerSocket across a Link.

Only java.net.ServerSocket objects created by the platform default socket implementation are supported by this method. Passing an unsupported ServerSocket instance to this method will result in an IllegalArgumentException.

Parameters:
s - the ServerSocket to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given ServerSocket
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getServerSocket()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

newDatagramSocketMessage

public static java.lang.isolate.IsolateMessage newDatagramSocketMessage(DatagramSocket s)
Creates an IsolateMessage for sending the given DatagramSocket across a Link.

Only java.net.DatagramSocket objects created by the platform default socket implementation are supported by this method. Passing an unsupported DatagramSocket instance to this method will result in an IllegalArgumentException.

Parameters:
s - the DatagramSocket to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given DatagramSocket
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getDatagramSocket()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

newFileInputStreamMessage

public static java.lang.isolate.IsolateMessage newFileInputStreamMessage(FileInputStream s)
Creates an IsolateMessage for sending the given FileInputStream across a Link.

Parameters:
s - the FileInputStream to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given FileInputStream
Throws:
NullPointerException - if s is null
See Also:
Link.send(IsolateMessage), getFileInputStream()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
CDCv1.0

newFileOutputStreamMessage

public static java.lang.isolate.IsolateMessage newFileOutputStreamMessage(FileOutputStream s)
Creates an IsolateMessage for sending the given FileOutputStream across a Link.

Parameters:
s - the FileOutputStream to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given FileOutputStream
Throws:
NullPointerException - if s is null
See Also:
Link.send(IsolateMessage), getFileOutputStream()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
CDCv1.0

newSerializableMessage

public static java.lang.isolate.IsolateMessage newSerializableMessage(Object o)
Creates an IsolateMessage for sending the given serializable object across a Link.

Sending the returned message across a Link via Link.send behaves as if the contained object was first serialized by an invocation of ObjectOutputStream.writeObject. If serialization of the object would have any visible side-effects they will occur when send is invoked.

Note that logical serialization and associated side-effects occur only when the message is sent, and on each such occasion. Consequently if the message is never sent no serialization or serialization side- effects will occur, and if the message is sent more than once serialization and serialization side-effects will occur each time.

Also note that the object is not copied when the message is created, but is contained by reference, hence that any changes to it's non- transient mutable state which occur between message creation and the first send, or between subsequent sends will be visible in the logical copies of the object obtained by the receiving isolate.

Parameters:
o - the Serializable object to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given Serializable
Throws:
NullPointerException - if o is null
See Also:
Link.send(IsolateMessage), getSerializable()
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
CDCv1.0

newPipeSinkChannelMessage

public static java.lang.isolate.IsolateMessage newPipeSinkChannelMessage(Pipe.SinkChannel ps)
Creates an IsolateMessage for sending the given Pipe.SinkChannel across a Link.

Only java.nio.channel.Pipe.SinkChannel objects created by the platform default channel provider are supported by this method. Passing an unsupported Pipe.SinkChannel instance to this method will result in an IllegalArgumentException.

Parameters:
ps - the Pipe.SinkChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given Pipe.SinkChannel
Throws:
NullPointerException - if ps is null
See Also:
Link.send(IsolateMessage), getPipeSinkChannel()
This API element may not be present in some J2ME profiles.

newPipeSourceChannelMessage

public static java.lang.isolate.IsolateMessage newPipeSourceChannelMessage(Pipe.SourceChannel ps)
Creates an IsolateMessage for sending the given Pipe.SourceChannel across a Link.

Only java.nio.channel.Pipe.SourceChannel objects created by the platform default channel provider are supported by this method. Passing an unsupported Pipe.SourceChannel instance to this method will result in an IllegalArgumentException.

Parameters:
ps - the Pipe.SourceChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given Pipe.SourceChannel
Throws:
NullPointerException - if ps is null
See Also:
Link.send(IsolateMessage), getPipeSourceChannel()
This API element may not be present in some J2ME profiles.

newIsolateEventMessage

public static java.lang.isolate.IsolateMessage newIsolateEventMessage(java.lang.isolate.IsolateEvent ie)
Creates an IsolateMessage for sending the given IsolateEvent across a Link.

Parameters:
ie - the IsolateEvent to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given IsolateEvent
Throws:
NullPointerException - if ie is null
See Also:
Link.send(IsolateMessage), getIsolateEvent()

newCompositeMessage

public static java.lang.isolate.IsolateMessage newCompositeMessage(java.lang.isolate.IsolateMessage[] messages)
Creates an IsolateMessage for sending the given IsolateMessages across a Link atomically.

Note that only the IsolateMessage reference elements of the given array are copied during construction of the composite message and that no reference to the array itself is retained. Consequently subsequent modification of the array will have no effect on the contents of the returned composite message.

Parameters:
messages - an array containing the messages to wrap in an IsolateMessage
Returns:
a new IsolateMessage that wraps the given array of messages
Throws:
NullPointerException - if messages is null
IllegalArgumentException - if the messages parameter is non-null but contains a null reference
See Also:
Link.send(IsolateMessage), getComposite()

getIsolate

public java.lang.isolate.Isolate getIsolate()
Gets a reference to the Isolate object wrapped in this message.

Returns:
the Isolate object wrapped in this message
Throws:
IllegalStateException - if this message does not contain an Isolate
See Also:
newIsolateMessage(java.lang.isolate.Isolate)

getLink

public java.lang.isolate.Link getLink()
Gets a reference to the Link object wrapped in this message.

Returns:
the Link object wrapped in this message
Throws:
IllegalStateException - if this message does not contain a Link
See Also:
newLinkMessage(java.lang.isolate.Link)

getByteBuffer

public ByteBuffer getByteBuffer()
Gets a reference to the ByteBuffer object wrapped in this message.

Returns:
a reference to the ByteBuffer object wrapped in this message.
Throws:
IllegalStateException - if this message does not contain a ByteBuffer
See Also:
newByteBufferMessage(java.nio.ByteBuffer)
This API element may not be present in some J2ME profiles.

getByteArray

public byte[] getByteArray()
Gets a reference to the byte array wrapped in this message.

Returns:
a reference to the byte array wrapped in this message
Throws:
IllegalStateException - if this message does not contain a byte array
See Also:
newByteArrayMessage(byte[])

getString

public String getString()
Gets a reference to the String wrapped in this message.

Returns:
a reference to the String wrapped in this message
Throws:
IllegalStateException - if this message does not contain a String
See Also:
newStringMessage(java.lang.String)

getSocket

public Socket getSocket()
Gets a reference to the Socket wrapped in this message.

Returns:
a reference to the Socket wrapped in this message
Throws:
IllegalStateException - if this message does not contain a Socket
See Also:
newSocketMessage(java.net.Socket)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

getServerSocket

public ServerSocket getServerSocket()
Gets a reference to the ServerSocket wrapped in this message.

Returns:
a reference to the ServerSocket wrapped in this message
Throws:
IllegalStateException - if this message does not contain a ServerSocket
See Also:
newServerSocketMessage(java.net.ServerSocket)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

getSerializable

public Object getSerializable()
                       throws LinkSerializationException
Gets a reference to the object wrapped in this message.

If this message was received from a link the first invocation of getSerializable will return an object created as if by an invocation of ObjectInputStream.readObject on the serialized representation contained in this message. Subsequent invocations of this method will return the same object returned by the first invocation. Consequently, deserialization (including any possible side effects) happens no more than once. Note that if getSerializable is never invoked during the lifetime of this message, neither deserialization nor its possible side effects will occur.

If this message was not received from a link, i.e., if it was created by the current isolate, the object returned will be the same as the object supplied as the argument to the newSerializableMessage factory method that created it. In this case, an invocation of this method will not result in any serialization or deserialization or their side effects.

If there are errors deserializing an object, subsequent attempts to invoke this method will result in an IllegalStateException.

Returns:
the object wrapped in this message
Throws:
IllegalStateException - if this message does not contain a serialized object
LinkSerializationException - if a Serialization error occurred
See Also:
newSerializableMessage(java.lang.Object)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
CDCv1.0

getPipeSinkChannel

public Pipe.SinkChannel getPipeSinkChannel()
Gets a reference to the Pipe.SinkChannel wrapped in this message.

Returns:
a reference to the Pipe.SinkChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a Pipe.SinkChannel
See Also:
newPipeSinkChannelMessage(java.nio.channels.Pipe.SinkChannel)
This API element may not be present in some J2ME profiles.

getPipeSourceChannel

public Pipe.SourceChannel getPipeSourceChannel()
Gets a reference to the Pipe.SourceChannel wrapped in this message.

Returns:
a reference to the Pipe.SourceChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a Pipe.SourceChannel
See Also:
newPipeSourceChannelMessage(java.nio.channels.Pipe.SourceChannel)
This API element may not be present in some J2ME profiles.

getIsolateEvent

public java.lang.isolate.IsolateEvent getIsolateEvent()
Gets a reference to the IsolateEvent wrapped in this message.

Returns:
a reference to the IsolateEvent wrapped in this message
Throws:
IllegalStateException - if this message does not contain an IsolateEvent
See Also:
newIsolateEventMessage(java.lang.isolate.IsolateEvent)

getComposite

public java.lang.isolate.IsolateMessage[] getComposite()
Copies the IsolateMessages wrapped in this message to an array.

Returns:
a newly allocated array containing the IsolateMessages wrapped in this message.
Throws:
IllegalStateException - if this message is not a composite message
See Also:
newCompositeMessage(java.lang.isolate.IsolateMessage[])

acceptVisitor

public void acceptVisitor(java.lang.isolate.IsolateMessageVisitor visitor)
                   throws LinkSerializationException
Gets the content of this message via the given message visitor. Depending on the content type, the appropriate receiver method will be called in visitor. This is a convenience method for processing or dispatching isolate messages with unknown content.

Parameters:
visitor - The message visitor on which to invoke the appropriate method
Throws:
NullPointerException - if visitor is null
IllegalStateException - if the message receiver is unable to process the content of this message
LinkSerializationException - if a serialization error occurred while deserializing a serializable

equals

public boolean equals(Object obj)
Tests this IsolateMessage for equality with the given object. Returns true if and only if obj is not null and is an IsolateMessage and contains a reference == to the reference in this.

Overrides:
equals in class Object
Parameters:
obj - The object to be compared
Returns:
true if the objects are the same; false otherwise

getDatagramSocket

public DatagramSocket getDatagramSocket()
Gets a reference to the DatagramSocket wrapped in this message.

Returns:
a reference to the DatagramSocket wrapped in this message
Throws:
IllegalStateException - if this message does not contain a DatagramSocket
See Also:
newDatagramSocketMessage(java.net.DatagramSocket)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

getFileInputStream

public FileInputStream getFileInputStream()
Gets a reference to the FileInputStream wrapped in this message.

Returns:
a reference to the FileInputStream wrapped in this message.
Throws:
IllegalStateException - if this message does not contain a FileInputStream
See Also:
newFileInputStreamMessage(java.io.FileInputStream)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

getFileOutputStream

public FileOutputStream getFileOutputStream()
Gets a reference to the FileOutputStream wrapped in this message.

Returns:
a reference to the FileOutputStream wrapped in this message
Throws:
IllegalStateException - if this message does not contain a FileOutputStream
See Also:
newFileOutputStreamMessage(java.io.FileOutputStream)
This API element may not be present in some J2ME profiles.
This API element must be present with the following J2ME configurations, profiles, or optional packages:
FPv1.0

newSocketChannelMessage

public static java.lang.isolate.IsolateMessage newSocketChannelMessage(SocketChannel s)
Creates an IsolateMessage for sending the given SocketChannel across a Link.

Only socket channel objects created by the platform default socket implementation are supported by IsolateMessage. Passing a non-supported socket type to this method will result in an IllegalArgumentException.

Parameters:
s - the SocketChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given SocketChannel
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getSocketChannel()
This API element may not be present in some J2ME profiles.

newServerSocketChannelMessage

public static java.lang.isolate.IsolateMessage newServerSocketChannelMessage(ServerSocketChannel s)
Creates an IsolateMessage for sending the given ServerSocketChannel across a Link.

Only server socket channel objects created by the platform default socket implementation are supported by IsolateMessage. Passing a non-supported socket type to this method will result in an IllegalArgumentException.

Parameters:
s - the ServerSocketChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given ServerSocketChannel
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getServerSocketChannel()
This API element may not be present in some J2ME profiles.

newDatagramChannelMessage

public static java.lang.isolate.IsolateMessage newDatagramChannelMessage(DatagramChannel d)
Creates an IsolateMessage for sending the given DatagramChannel across a Link.

Only DatagramChannel objects created by the platform default socket implementation are supported by IsolateMessage. Passing a non-supported socket type to this method will result in an IllegalArgumentException.

Parameters:
d - the DatagramChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given DatagramChannel
Throws:
NullPointerException - if s is null
IllegalArgumentException - if s is not of a specific type supported by the implementation
See Also:
Link.send(IsolateMessage), getDatagramChannel()
This API element may not be present in some J2ME profiles.

newFileChannelMessage

public static java.lang.isolate.IsolateMessage newFileChannelMessage(FileChannel f)
Creates an IsolateMessage for sending the given FileChannel across a Link.

Only java.nio.channel.FileChannel objects created by the platform default channel provider are supported by this method. Passing an unsupported FileChannel instance to this method will result in an IllegalArgumentException.

Parameters:
f - the FileChannel to wrap in an IsolateMessage
Returns:
a new IsolateMessage that contains a reference to the given FileChannel
Throws:
NullPointerException - if s is null
See Also:
Link.send(IsolateMessage), getFileChannel()
This API element may not be present in some J2ME profiles.

getSocketChannel

public SocketChannel getSocketChannel()
Gets a reference to the SocketChannel wrapped in this message.

Returns:
a reference to the SocketChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a SocketChannel
See Also:
newSocketChannelMessage(java.nio.channels.SocketChannel)
This API element may not be present in some J2ME profiles.

getServerSocketChannel

public ServerSocketChannel getServerSocketChannel()
Gets a reference to the ServerSocketChannel wrapped in this message.

Returns:
a reference to the ServerSocketChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a ServerSocketChannel
See Also:
newServerSocketChannelMessage(java.nio.channels.ServerSocketChannel)
This API element may not be present in some J2ME profiles.

getDatagramChannel

public DatagramChannel getDatagramChannel()
Gets a reference to the DatagramChannel wrapped in this message.

Returns:
a reference to the DatagramChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a DatagramChannel
See Also:
newDatagramChannelMessage(java.nio.channels.DatagramChannel)
This API element may not be present in some J2ME profiles.

getFileChannel

public FileChannel getFileChannel()
Gets a reference to the FileChannel wrapped in this message.

Returns:
a reference to the FileChannel wrapped in this message
Throws:
IllegalStateException - if this message does not contain a FileChannel
See Also:
newFileChannelMessage(java.nio.channels.FileChannel)
This API element may not be present in some J2ME profiles.