com.sun.squawk.io.j2me.multicast
Class Protocol
java.lang.Object
com.sun.squawk.io.ConnectionBase
com.sun.squawk.io.j2me.multicast.Protocol
- All Implemented Interfaces:
- Connection, OutputConnection
public class Protocol
- extends ConnectionBase
- implements OutputConnection
GCF connection that multicasts to a number of configured output streams. The connection
can be established without specifying any delegate streams and have the delegate streams
added as a separate operation as shown below:
MulticastOutputStream mos = (MulticastOutputStream)Connector.openOutputStream("multicast:");
OutputStream fos = Connector.openOutputStream("file://out.txt;append=true");
OutputStream sos = Connector.openOutputStream("socket://host.domain.com:9999");
DataOutputStream dos = new DataOutputStream(mos);
mos.add(fos);
mos.add(sos);
dos.writeUTF("Hello World");
Or the connection can be established and have one or more initial delegate streams opened as shown below:
MulticastOutputStream mos = (MulticastOutputStream)Connector.openOutputStream("multicast:file://out.txt\;append=true;socket://host.domain.com:9999");
DataOutputStream dos = new DataOutputStream(mos);
dos.writeUTF("Hello World");
As indicated above, the URLs for any initial delegates are separated by ;
and as such must have
any embedded ;
s escaped with a backslash.
- Author:
- Doug Simon
Protocol
public Protocol()
open
public Connection open(String protocol,
String name,
int mode,
boolean timeouts)
throws IOException
- Opens the connection.
- Specified by:
open
in class ConnectionBase
- Parameters:
protocol
- The URL protocolname
- The URL for the connectionmode
- The access modetimeouts
- A flag to indicate that the caller
wants timeout exceptions
- Returns:
- A new Connection object
- Throws:
IOException
- If some other kind of I/O error occurs.
openOutputStream
public OutputStream openOutputStream()
throws IOException
- Opens and returns an output stream for this connection. The returned output stream
will be a
MulticastOutputStream
instance.
- Specified by:
openOutputStream
in interface OutputConnection
- Overrides:
openOutputStream
in class ConnectionBase
- Returns:
- a
MulticastOutputStream
instance
- Throws:
IOException
- if an I/O error occurs
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.