SunSPOT API V5.0


com.sun.squawk.io
Class ConnectionBase

java.lang.Object
  extended by com.sun.squawk.io.ConnectionBase
All Implemented Interfaces:
Connection
Direct Known Subclasses:
Protocol, Protocol, Protocol, Protocol, Protocol, Protocol, Protocol, Protocol, RadioConnectionBase

public abstract class ConnectionBase
extends Object
implements Connection

Base class for Connection protocols.


Constructor Summary
ConnectionBase()
           
 
Method Summary
 void close()
          Close
abstract  Connection open(String protocol, String name, int mode, boolean timeouts)
          Open a connection to a target.
 DataInputStream openDataInputStream()
          Create and open a connection input stream.
 DataOutputStream openDataOutputStream()
          Create and open a connection output stream.
 InputStream openInputStream()
          Open and return a data input stream for a connection.
 OutputStream openOutputStream()
          Open and return a data output stream for a connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionBase

public ConnectionBase()
Method Detail

close

public void close()
           throws IOException
Close

Specified by:
close in interface Connection
Throws:
IOException - If an I/O error occurs

open

public abstract Connection open(String protocol,
                                String name,
                                int mode,
                                boolean timeouts)
                         throws IOException
Open a connection to a target.

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:
IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
IOException - If some other kind of I/O error occurs.

openDataInputStream

public DataInputStream openDataInputStream()
                                    throws IOException
Create and open a connection input stream.

Returns:
A DataInputStream.
Throws:
IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
IOException - If some other kind of I/O error occurs.

openDataOutputStream

public DataOutputStream openDataOutputStream()
                                      throws IOException
Create and open a connection output stream.

Returns:
A DataOutputStream.
Throws:
IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
IOException - If some other kind of I/O error occurs.

openInputStream

public InputStream openInputStream()
                            throws IOException
Open and return a data input stream for a connection.

Returns:
An input stream
Throws:
IOException - If an I/O error occurs

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Open and return a data output stream for a connection.

Returns:
An input stream
Throws:
IOException - If an I/O error occurs

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.