80,490
社区成员
发帖
与我相关
我的任务
分享
public String readFromInputStream(InputStream in) {
int count = 0;
byte[] inDatas = null;
try {
while (count == 0 ) {
count = in.available();
}
inDatas = new byte[count];
in.read(inDatas);
return new String(inDatas, "gb2312");
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
private void sendData() {
try {
String context = getTestCase(sequence); //获取发送的数据
if (printWriter == null || context == null) {
if (printWriter == null) {
showInfo("发送失败");
return;
}
if (context == null) {
showInfo("请输入正确的文本");
return;
}
}
printWriter.print(context);
printWriter.flush();
// Log.i(tag, "--->> client send data!");
} catch (Exception e) {
failCount++;
Log.e(tag, "--->> send failure!" + e.toString());
} finally {
if (sequence == 25) {
sequence = 0;
loopCount++;
} else
sequence++;
}
}