Possible Duplicate:
In Java how do a read/convert an InputStream in to a string?
Hi, I want to convert this BufferedInputStream into my string. How can I do this?
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);