c语言 矿石和身份 地质勘探队员
发布网友
发布时间:2022-06-02 22:04
我来回答
共1个回答
热心网友
时间:2023-10-06 04:15
resStream = request.getInputStream();
ms = new ByteArrayOutputStream();
byte[] buf = new byte[4096];
int count;
while ((count = resStream.read(buf, 0, buf.length)) > 0) {
ms.write(buf, 0, count);
}
resStream.close();
body = new String(ms.toByteArray(), encoding);
} catch (UnknownHostException e) {
System.err.println( "服务器不可达【" + e.getMessage() + "】");
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (reqStream != null)
reqStream.close();
if (resStream != null)
resStream.close();
} catch (Exception ex) {
}
}