List of utility methods to do InputStream to String Convert
String | convertStreamToString(InputStream is) convert Stream To String Scanner s = new Scanner(is, "utf-8").useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; |
String | convertStreamToString(java.io.InputStream is) convert Stream To String try { return new Scanner(is).useDelimiter("\\A").next(); } catch (java.util.NoSuchElementException e) { return ""; |
String | convertStreamToString(java.io.InputStream is) convert Stream To String java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; |
String | streamToString(InputStream is) stream To String String str = ""; if (is != null) { StringBuilder sb = new StringBuilder(); String line; try { BufferedReader reader = new BufferedReader( new InputStreamReader(is)); while ((line = reader.readLine()) != null) { ... |
String | stringFromInputStream(InputStream is) string From Input Stream BufferedReader reader = new BufferedReader( new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); return sb.toString(); |
String | getStringFromInputStream(InputStream is) Converts inputStream into String 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(); |