de.avetana.bluetooth.connection
Class Connector

java.lang.Object
  extended byde.avetana.bluetooth.connection.Connector
Direct Known Subclasses:
Connector

public class Connector
extends java.lang.Object

This class only supports the RFCOMM Protocol for the moment. It will be soon extended in order to support RFCOMM and maybe OBEX. Remote (btspp://010203040506:1;master=false) or local (btspp://localhost:3B9FA89520078C303355AAA694238F07:1;name=Avetana Service;) URLs are supported. The class JSR82URL verifies that the URL is a correct Bluetooth connection URL, which matches the RFC 1808 specification. (see http://www.w3.org/Addressing/rfc1808.txt for more information).


Field Summary
static int READ
           
static int READ_WRITE
           
static int WRITE
           
 
Constructor Summary
Connector()
           
 
Method Summary
static Connection open(java.lang.String url)
           
static Connection open(java.lang.String url, int mode)
          Create and open a Connection.
static Connection open(java.lang.String url, int mode, boolean timeouts)
          Create and open a Connection
static java.io.DataInputStream openDataInputStream(java.lang.String url)
          Create and open a connection dataInputStream.
static java.io.DataOutputStream openDataOutputStream(java.lang.String url)
          Create and open a connection dataOutput stream.
static java.io.InputStream openInputStream(java.lang.String url)
          Create and open a connection input stream.
static java.io.OutputStream openOutputStream(java.lang.String url)
          Create and open a connection output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ

public static final int READ
See Also:
Constant Field Values

WRITE

public static final int WRITE
See Also:
Constant Field Values

READ_WRITE

public static final int READ_WRITE
See Also:
Constant Field Values
Constructor Detail

Connector

public Connector()
Method Detail

open

public static Connection open(java.lang.String url)
                       throws java.io.IOException
Throws:
java.io.IOException

open

public static Connection open(java.lang.String url,
                              int mode)
                       throws java.io.IOException
Create and open a Connection.

Parameters:
url - The URL for the connection.
mode - The access mode
Returns:
A new Connection object.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs. This call is equivilant to Connection.open(url).

open

public static Connection open(java.lang.String url,
                              int mode,
                              boolean timeouts)
                       throws java.io.IOException
Create and open a Connection

Parameters:
url - The URL for the connection.
mode - The access mode
timeouts - A flag to indicate that the called wants timeout exceptions
Returns:
A new Connection object.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs. This call is equivilant to Connection.open(url).

openDataInputStream

public static java.io.DataInputStream openDataInputStream(java.lang.String url)
                                                   throws java.lang.Exception
Create and open a connection dataInputStream.

Parameters:
url - The URL for the connection.
Returns:
A DataInputStream.
Throws:
java.io.IOException
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.Exception

openDataOutputStream

public static java.io.DataOutputStream openDataOutputStream(java.lang.String url)
                                                     throws java.lang.Exception
Create and open a connection dataOutput stream.

Parameters:
url - The URL for the connection.
Returns:
A DataOutputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.Exception

openInputStream

public static java.io.InputStream openInputStream(java.lang.String url)
                                           throws java.lang.Exception
Create and open a connection input stream.

Parameters:
url - The URL for the connection.
Returns:
A InputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.Exception

openOutputStream

public static java.io.OutputStream openOutputStream(java.lang.String url)
                                             throws java.lang.Exception
Create and open a connection output stream.

Parameters:
url - The URL for the connection.
Returns:
A DataOutputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the connection cannot be found.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.Exception