按字节读取输入流并替换回车换行符,经测试windows和Linux通用
in = req.getInputStream();// 取返回值
StringBuffer buffer = new StringBuffer();
int i = 0;
while (i != -1) {
i = in.read();
if (i != -1) {
buffer.append((char) i);
}
}
String xmlresult = new String(buffer.toString()
.getBytes("iso-8859-1"), "utf-8");
xmlresult=xmlresult.replaceAll("\r", "").replaceAll("\n", "");