Skip to content

Instantly share code, notes, and snippets.

@BlaShadow
Created February 28, 2014 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlaShadow/9271769 to your computer and use it in GitHub Desktop.
Save BlaShadow/9271769 to your computer and use it in GitHub Desktop.
InputStream to String
private static String getStringFromInputStream(InputStream inputStream) {
BufferedReader buffer = null;
StringBuilder sb = new StringBuilder();
String line;
try {
buffer = new BufferedReader(new InputStreamReader(inputStream));
while ((line = buffer.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
e.printStackTrace();
}
return sb.toString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment