抽象类,实现 IComm 接口的默认功能。
更多...
|
int | BytesAvailable () |
| Number of bytes available to read. This is estimate and number can change as data is received.
|
|
void | Close () |
| Closes a connection.
|
|
boolean | Connected () |
| true if connection is established
|
|
String | Descriptor () |
| string descriptor of the connection.
|
|
void | Open () |
| Opens a connection.
|
|
byte[] | Read () |
| Read all bytes available.
|
|
void | Read (OutputStream binDataIn) throws IOException |
| Reads all bytes available into the stream passed in.
|
|
void | WaitForData (int msTimeOut) |
| 等待当前线程有可用数据 BytesAvailable。当前线程会休眠直到接收到数据或超时为止。此为阻塞调用。 更多...
|
|
void | Write (byte[] dataOut) |
| Writes all bytes from the array passed in.
|
|
void | Write (InputStream binReader) throws IOException |
| 从输入流写入输出流。 更多...
|
|
byte[] | WriteAndWaitForResponse (byte[] dataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| 将字节数据写入输出流并返回接收到的数据。返回的数据是接收到的任何数据或收到的完成标记。等待响应超时后返回。 更多...
|
|
void | WriteAndWaitForResponse (OutputStream binDataIn, InputStream binDataOut, int responseStartTimeOut, int responseEndTimeOut, String completetionToken) throws IOException |
| 将 binDataOut 流数据写入输出流,并将接收到的数据返回到 binDataIn 流中。返回的数据是收到的数据或收到的完成标记。等待响应超时后返回。 更多...
|
|
◆ WaitForData()
void WaitForData |
( |
int |
msTimeOut | ) |
|
等待当前线程有可用数据 BytesAvailable。当前线程会休眠直到接收到数据或超时为止。此为阻塞调用。
- 参数
-
[in] | msTimeOut | 在没有收到数据前返回的毫秒超时。 |
实现了 IComm.
◆ Write()
void Write |
( |
InputStream |
binReader | ) |
throws IOException |
◆ WriteAndWaitForResponse() [1/2]
byte [] WriteAndWaitForResponse |
( |
byte[] |
dataOut, |
|
|
int |
responseStartTimeOut, |
|
|
int |
responseEndTimeOut, |
|
|
String |
completionToken |
|
) |
| throws IOException |
将字节数据写入输出流并返回接收到的数据。返回的数据是接收到的任何数据或收到的完成标记。等待响应超时后返回。
- 返回值
-
byte[] | 从连接接收到的字节数组。
返回的数据是接收到的任何数据或收到的完成标记。 |
- 参数
-
[in] | dataOut | 要写入连接的源字节数组。 |
[in] | responseStartTimeOut | 等待接收到第一个数据的超时。从第一个字节开始计时。 |
[in] | responseEndTimeOut | 没有新数据接收的超时。从最后一个字节后开始计时。 |
[in] | completetionToken | 标示预期响应结束的字符串标记。如果只是想在写入数据到连接后等待响应,可以是空字符串。 |
实现了 IComm.
◆ WriteAndWaitForResponse() [2/2]
void WriteAndWaitForResponse |
( |
OutputStream |
binDataIn, |
|
|
InputStream |
binDataOut, |
|
|
int |
responseStartTimeOut, |
|
|
int |
responseEndTimeOut, |
|
|
String |
completionToken |
|
) |
| throws IOException |
将 binDataOut 流数据写入输出流,并将接收到的数据返回到 binDataIn 流中。返回的数据是收到的数据或收到的完成标记。等待响应超时后返回。
- 参数
-
[out] | binDataIn | 用于存储从连接接收到的响应的目标流。 |
[in] | binDataOut | 写入连接的源流数据。 |
[in] | responseStartTimeOut | 等待接收到第一个数据的超时。从第一个字节开始计时。 |
[in] | responseEndTimeOut | 没有新数据接收的超时。从最后一个字节后开始计时。 |
[in] | completetionToken | 标示预期响应结束的字符串标记。如果只是想在写入数据到连接后等待响应,可以是空字符串。 |
实现了 IComm.