List of utility methods to do InputStream to String Convert
String | inStream2String(InputStream is) in Stream String ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len = -1; while ((len = is.read(buf)) != -1) { baos.write(buf, 0, len); return new String(baos.toByteArray()); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); return null; } finally { if (baos != null) { try { baos.close(); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); |
String | inputStream2String(InputStream is) input Stream String ByteArrayOutputStream baos = new ByteArrayOutputStream(); int i = -1; while ((i = is.read()) != -1) { baos.write(i); return baos.toString(); |
String | inStream2String(InputStream is) in Stream String ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len = -1; while ((len = is.read(buf)) != -1) { baos.write(buf, 0, len); return new String(baos.toByteArray()); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); return null; } finally { if (baos != null) { try { baos.close(); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); |
String | fromStream(InputStream inputStream) from Stream BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream), BUFFER_SIZE); StringBuilder stringBuilder = new StringBuilder(); String line; try { while ((line = reader.readLine()) != null) { ALog.i(line); stringBuilder.append(line); ... |
String | parseString(InputStream is) parse 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(); |
String | convertStreamToString(InputStream is) convert Stream To String if (is != null) { Writer writer = new StringWriter(); char[] buffer = new char[1024]; try { Reader reader = new BufferedReader(new InputStreamReader( is, "UTF-8")); int n; while ((n = reader.read(buffer)) != -1) { ... |
String | readToString(final InputStream inputStream) read To String return new Scanner(inputStream).useDelimiter("\\A").next(); |
String | inputStreamToString(InputStream inputstream) input Stream To String InputStreamReader inputstreamreader = new InputStreamReader( inputstream); BufferedReader bufferedreader = new BufferedReader( inputstreamreader); StringBuilder stringbuilder = new StringBuilder(); do { String s = bufferedreader.readLine(); if (s != null) { ... |
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 | inputStreamToString(InputStream is) Gets the string representation of the InputStream if (is != null) { BufferedReader reader = new BufferedReader( new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + "\n"); ... |