by
104 8
0
4
2,169
0
Top 1% !
Popular
Famous
Specified
Popularity: 8565th place
This snippet is Public
No tags for this snippet yet.
Architecturex86_64
InputType0InputStream
JVMjre6
LanguageJava
LicenseMIT_X11
MethodNamegetStringFromInputStream
OSWindows
OutputTypeString

Input Stream to Stream

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/5818/Input-Stream-to-Stream?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static String getStringFromInputStream(InputStream is) { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return sb.toString(); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus