Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk.io.j2me.multicastoutput
Class Protocol

    java.lang.Object
      com.sun.squawk.io.ConnectionBase
          com.sun.squawk.io.j2me.multicastoutput.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("multicastoutput:");
>          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("multicastoutput: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.

Constructor Summary
`Protocol()`

Method Summary
`Connection` | `open(String protocol, String name, int mode, boolean timeouts)` Opens the connection.
`OutputStream` | `openOutputStream()` Opens and returns an output stream for this connection.

Methods inherited from class com.sun.squawk.io.ConnectionBase
`close, openDataInputStream, openDataOutputStream, openInputStream`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface javax.microedition.io.OutputConnection
`openDataOutputStream`

Methods inherited from interface javax.microedition.io.Connection
`close`

Constructor Detail

### Protocol

    public Protocol()

Method Detail

### 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 protocol
    `name` - The URL for the connection
    `mode` - The access mode
    `timeouts` - A flag to indicate that the caller wants timeout exceptions
  Returns:
    A new Connection object
  Throws:
    `ConnectionNotFoundException` - If the connection cannot be found.
    `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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"