|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CommPortInterface
A communications port. CommPortInterface is an interface that describes a communications port made available by the underlying system. CommPort is an abstract class that includes high-level methods for controlling I/O that are common to different kinds of communications ports. SerialPort and ParallelPort are subclasses of CommPort that include additional methods for low-level control of physical communications ports. There are no public constructors for CommPort. Instead an application should use the static method CommPortIdentifier.getPortIdentifiers to generate a list of available ports. It then chooses a port from this list and calls CommPortIdentifier.openPort to create a CommPort object. Finally, it casts the CommPort object to a physical communications device class like SerialPort or ParallelPort.
CommPortIdentifier
,
ParallelPort
,
SerialPort
Method Summary | |
---|---|
void |
close()
Closes this communications port. |
void |
disableReceiveFraming()
Disables receive framing. |
void |
disableReceiveThreshold()
Disables receive threshold. |
void |
disableReceiveTimeout()
Disables receive timeout. |
void |
enableReceiveFraming(int framingByte)
Enables receive framing. |
void |
enableReceiveThreshold(int thresh)
Enables receive threshold. |
void |
enableReceiveTimeout(int rcvTimeout)
Enables receive timeout. |
int |
getInputBufferSize()
|
java.io.InputStream |
getInputStream()
|
java.lang.String |
getName()
Gets the name of the communications port. |
int |
getOutputBufferSize()
|
java.io.OutputStream |
getOutputStream()
|
int |
getReceiveFramingByte()
|
int |
getReceiveThreshold()
|
int |
getReceiveTimeout()
|
boolean |
isReceiveFramingEnabled()
|
boolean |
isReceiveThresholdEnabled()
|
boolean |
isReceiveTimeoutEnabled()
|
void |
setInputBufferSize(int size)
Sets the input buffer size. |
void |
setOutputBufferSize(int size)
Sets the output buffer size. |
java.lang.String |
toString()
|
Method Detail |
---|
java.lang.String toString()
toString
in class java.lang.Object
java.lang.String getName()
java.io.InputStream getInputStream() throws java.io.IOException
Threshold | Timeout | Blocking behaviour | ||
---|---|---|---|---|
State | Value | State | Value | |
disabled | disabled | block until data is available | ||
enabled | m bytes | disabled | block until min(m, n) bytes are available | |
disabled | enabled | t ms | block for t ms or until data is available | |
enabled | m bytes | enabled | t ms | block for t ms or until min(m, n) bytes are available |
java.io.IOException
java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
void close()
void enableReceiveThreshold(int thresh) throws UnsupportedCommOperationException
thresh
- the number of bytes in the input buffer
UnsupportedCommOperationException
- if receive threshold is
not supported by the driverdisableReceiveThreshold()
void disableReceiveThreshold()
enableReceiveThreshold(int)
boolean isReceiveThresholdEnabled()
enableReceiveThreshold(int)
int getReceiveThreshold()
enableReceiveThreshold(int)
void enableReceiveTimeout(int rcvTimeout) throws UnsupportedCommOperationException
rcvTimeout
- the number of milliseconds to block for
UnsupportedCommOperationException
- if receive timeout is
not supported by the driverdisableReceiveTimeout()
void disableReceiveTimeout()
enableReceiveTimeout(int)
boolean isReceiveTimeoutEnabled()
enableReceiveTimeout(int)
int getReceiveTimeout()
enableReceiveTimeout(int)
void enableReceiveFraming(int framingByte) throws UnsupportedCommOperationException
framingByte
- the frame delimiter
UnsupportedCommOperationException
- if receive framing is
not supported by the driverdisableReceiveFraming()
void disableReceiveFraming()
enableReceiveFraming(int)
boolean isReceiveFramingEnabled()
enableReceiveFraming(int)
int getReceiveFramingByte()
enableReceiveFraming(int)
void setInputBufferSize(int size)
size
- in bytesint getInputBufferSize()
void setOutputBufferSize(int size)
size
- in bytesint getOutputBufferSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |