Skip to content

Instantly share code, notes, and snippets.

@kibao
Created June 10, 2013 07:12
Show Gist options
  • Save kibao/5747029 to your computer and use it in GitHub Desktop.
Save kibao/5747029 to your computer and use it in GitHub Desktop.
InputStream to String
InputStream response;
ByteArrayOutputStream buf = new ByteArrayOutputStream();
int result = response.read();
while(result != -1) {
byte b = (byte)result;
buf.write(b);
result = response.read();
}
System.out.println(buf.toString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment