SunSPOT API V3.0


com.sun.squawk.io.j2me.socket
Class Protocol

java.lang.Object
  extended by com.sun.squawk.io.ConnectionBase
      extended by com.sun.squawk.io.j2me.socket.Protocol
All Implemented Interfaces:
Connection, InputConnection, OutputConnection, StreamConnection

public class Protocol
extends ConnectionBase
implements StreamConnection

Support for socket connections on device. This allows a generic stream connection with an external host (on a TCP network). This must be used in conjunction with a SocketProxy on a host computer.

Author:
Martin Morissette

Constructor Summary
Protocol()
           
 
Method Summary
 void close()
          Close the connection.
 Connection open(String protocol, String name, int mode, boolean timeouts)
          Open the connection
 InputStream openInputStream()
          Returns an input stream for this socket.
 OutputStream openOutputStream()
          Returns an output stream for this socket.
 
Methods inherited from class com.sun.squawk.io.ConnectionBase
openDataInputStream, openDataOutputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream
 
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream
 

Constructor Detail

Protocol

public Protocol()
Method Detail

open

public Connection open(String protocol,
                       String name,
                       int mode,
                       boolean timeouts)
                throws IOException
Open the connection

Specified by:
open in class ConnectionBase
Parameters:
name - :
protocol - The URL protocol
mode - The access mode
timeouts - A flag to indicate that the caller wants timeout exceptions
Returns:
A new Connection object
Throws:
IOException

openInputStream

public InputStream openInputStream()
                            throws IOException
Returns an input stream for this socket.

Specified by:
openInputStream in interface InputConnection
Overrides:
openInputStream in class ConnectionBase
Returns:
an input stream for reading bytes from this socket.
Throws:
IOException - if an I/O error occurs when creating the input stream.

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Returns an output stream for this socket.

Specified by:
openOutputStream in interface OutputConnection
Overrides:
openOutputStream in class ConnectionBase
Returns:
an output stream for writing bytes to this socket.
Throws:
IOException - if an I/O error occurs when creating the output stream.

close

public void close()
           throws IOException
Close the connection.

Specified by:
close in interface Connection
Overrides:
close in class ConnectionBase
Throws:
IOException - if an I/O error occurs when closing the connection.

SunSPOT API V3.0


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