BufferedInputStream到字符串转换?
嗨,我想将此BufferedInputStream放入我的字符串中,我该怎么做?
BufferedInputStream in = new BufferedInputStream(sktClient.getInputStream() );String a= in.read();
回答:
BufferedInputStream in = new BufferedInputStream(sktClient.getInputStream());
byte[] contents = new byte[1024];
int bytesRead = 0;String strFileContents;
while((bytesRead = in.read(contents)) != -1) {
strFileContents += new String(contents, 0, bytesRead);
}
System.out.print(strFileContents);
以上是 BufferedInputStream到字符串转换? 的全部内容, 来源链接: utcz.com/qa/421848.html