com.dctl.j2me.io.comm
Class Connection
java.lang.Object
|
+--com.dctl.j2me.io.BaseConnection
|
+--com.dctl.j2me.io.comm.Connection
- All Implemented Interfaces:
- Connection, InputConnection, OutputConnection, StreamConnection
- public class Connection
- extends BaseConnection
- implements StreamConnection
The comm connection. This allows a UART to be opened using the format:
Connector.open("comm://[;param[&optional params...]]");
For example:
Connector.open("comm://1;speed=38400&bits=6&stop=1&parity=none") opens a port
at 38400 bits per second, 6 bits, 1 stop bit and no parity.
The available parameters are:
- speed - this is the speed in bits per second of the connection
- bits - the number of bits to use
- stop - the number of stop bits to use
- parity - the parity. either odd, even or none
- flow - either off, sw or hw
|
Constructor Summary |
Connection()
Create a new connection - prevent others from doing it |
Connection
public Connection()
- Create a new connection - prevent others from doing it
setParameters
public void setParameters(java.lang.String url,
int mode,
boolean timeouts)
throws IOException
- Set the URL, mode and timeouts
- Specified by:
setParameters in class BaseConnection
- Parameters:
url - The URL passed to connector.openmode - The mode passed to connector.open or DEFAULTtimeouts - true if timeout exceptions should occur
- Throws:
IOException - if there is a problem
openOutputStream
public OutputStream openOutputStream()
throws IOException
- Open the output stream
- Specified by:
openOutputStream in interface OutputConnection
- Returns:
- the output stream to use
- Throws:
IOException - if there is a problem
openDataOutputStream
public java.io.DataOutputStream openDataOutputStream()
throws IOException
- Open the data output stream
- Specified by:
openDataOutputStream in interface OutputConnection
- Returns:
- null (not supported)
- Throws:
IOException - if there is a problem
openInputStream
public InputStream openInputStream()
throws IOException
- Open the input stream
- Specified by:
openInputStream in interface InputConnection
- Returns:
- the input stream to use
- Throws:
IOException - if there is a problem
openDataInputStream
public java.io.DataInputStream openDataInputStream()
throws IOException
- Open the data input stream
- Specified by:
openDataInputStream in interface InputConnection
- Returns:
- null (not supported)
- Throws:
IOException - if there is a problem
close
public void close()
throws IOException
- Close the connection
- Specified by:
close in interface Connection
- Throws:
IOException - if there is an error
DCT Lightfoot v3 API specification