List of utility methods to do InputStream to String
String | inputStreamToString(InputStream is) input Stream To String StringWriter sw = new StringWriter(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String line; try { while ((line = reader.readLine()) != null) { sw.append(line).append('\n'); return sw.toString(); ... |
String | inputStreamToString(InputStream is) input Stream To String InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); StringWriter sw = new StringWriter(); char c[] = new char[1024]; while (true) { int n = br.read(c, 0, c.length); if (n < 0) break; ... |
String | inputStreamToString(InputStream is) Utility method for helping with JXTA messages. final byte[] buffer = new byte[0x10000]; StringBuilder out = new StringBuilder(); int read; do { read = is.read(buffer, 0, buffer.length); if (read > 0) { out.append(new String(buffer, 0, read)); } while (read >= 0); return out.toString(); |
String | inputStreamToString(InputStream is) input Stream To String StringBuilder sb = new StringBuilder(); Reader reader = new InputStreamReader(is); char[] buffer = new char[STREAM_BUFFER_SIZE]; int count; while ((count = reader.read(buffer)) > 0) { sb.append(buffer, 0, count); return sb.toString(); ... |
String | inputStreamToString(InputStream is) input Stream To String if (is == null) { throw new IllegalArgumentException("InputStream was null!"); final int bufferSize = 1024; final char[] buffer = new char[bufferSize]; final StringBuilder out = new StringBuilder(); Reader in = new InputStreamReader(is, "UTF-8"); for (;;) { ... |
String | inputStreamToString(InputStream is) input Stream To String return new String(exhaustInputStreamUnchecked(is)); |
String | inputStreamToString(InputStream s) input Stream To String ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; try { while ((length = s.read(buffer)) != -1) { result.write(buffer, 0, length); } catch (IOException e1) { ... |
String | inputStreamToString(InputStream stream) Utility method which converts an InputStream to a String. ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; String resultString = null; while ((length = stream.read(buffer)) != -1) { result.write(buffer, 0, length); resultString = result.toString("UTF-8"); ... |
String[] | InputStreamToStringArray(InputStream input_stream) Input Stream To String Array return InputStreamToStringList(input_stream).toArray(new String[0]); |
StringBuffer | inputStreamToStringBuffer(InputStream stream) input Stream To String Buffer InputStreamReader reader = new InputStreamReader(stream); StringBuffer str = new StringBuffer(); char[] buff = new char[8192]; int len = 0; while ((len = reader.read(buff)) != -1) { str.append(buff, 0, len); reader.close(); ... |