Package ej.ecom.io
Interface CommConnection
-
- All Superinterfaces:
Connection,InputConnection,OutputConnection,StreamConnection
public interface CommConnection extends StreamConnection
This interface defines aConnectionto a logical serial port, which is aStreamConnection. There is no way from this side of the connection to know the connection state on the other side (particularly, closing the other side has no effect on this side; a thread blocked onInputStream.read()will infinitely block).The generic URL format described in
Connectoris specified as following:protocol: commname: theCommPortnameparams: optional connection parameters in the following listbaudrate: positive integer (9600 by default)bitsperchar: positive integer (8 by default)stopbits:1|2|1.5 (1 by default)parity:odd|even|none (none by default)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetBaudrate()Gets the current configured baudrate.InputStreamopenInputStream()Returns anInputStreamwhich implements theBitsInputinterface.OutputStreamopenOutputStream()Returns anOutputStreamwhich implements theBitsOutputinterface.intsetBaudrate(int baudrate)Configures the baudrate.-
Methods inherited from interface ej.ecom.io.Connection
close
-
Methods inherited from interface ej.ecom.io.InputConnection
openDataInputStream
-
Methods inherited from interface ej.ecom.io.OutputConnection
openDataOutputStream
-
-
-
-
Method Detail
-
getBaudrate
int getBaudrate()
Gets the current configured baudrate.- Returns:
- the current configured baudrate.
-
setBaudrate
int setBaudrate(int baudrate)
Configures the baudrate. If the given baudrate cannot be configured, connection is configured with valid baudrate that can be retrieved bygetBaudrate().- Parameters:
baudrate- the new baudrate- Returns:
- the previous baudrate.
-
openInputStream
InputStream openInputStream() throws IOException
Returns anInputStreamwhich implements theBitsInputinterface. This implementation is useful when thisConnectionsupports more than 8 bits per frame.- Specified by:
openInputStreamin interfaceInputConnection- Returns:
- the open
InputStream. - Throws:
IOException- if a stream is already open
-
openOutputStream
OutputStream openOutputStream() throws IOException
Returns anOutputStreamwhich implements theBitsOutputinterface. This implementation is useful when thisConnectionsupports more than 8 bits per frame.- Specified by:
openOutputStreamin interfaceOutputConnection- Returns:
- the open
OutputStream. - Throws:
IOException- if a stream is already open
-
-