List of utility methods to do InputStream to String Convert
String | convertInputStreamToString(InputStream inputStream) convert Input Stream To String BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String line = ""; String result = ""; while ((line = bufferedReader.readLine()) != null) { result += line; inputStream.close(); ... |
String | inputStream2String(InputStream is) input Stream String BufferedReader in = new BufferedReader(new InputStreamReader(is)); StringBuffer buffer = new StringBuffer(); String line = ""; try { while ((line = in.readLine()) != null) { buffer.append(line); } catch (IOException e) { ... |
String | readStreamAsString(InputStream is) read Stream As String StringBuffer fStr = new StringBuffer(); try { BufferedReader reader = new BufferedReader( new InputStreamReader(is)); String line = null; while ((line = reader.readLine()) != null) { fStr.append(line).append("\n"); reader.close(); } catch (Exception e) { throw new Error(e); return fStr.toString(); |
String | readStringFromStream(InputStream is) Reads the entire InputStream and returns its content as a single String return readStringFromBufferedReader(createBufferedUtf8Reader(is));
|
String | getString(InputStream is) Get string from an InputStream object if (is == null) throw new NullPointerException("null InputStream object"); char[] buf = new char[BUFF_SIZE]; Reader r = new InputStreamReader(is, "UTF-8"); StringBuilder s = new StringBuilder(); while (true) { int n = r.read(buf); if (n < 0) ... |
String | inputStream2String(InputStream is) convert inputstream to string ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] data = new byte[1024]; int len = 0; String result = ""; if (is != null) { try { while ((len = is.read(data)) != -1) { baos.write(data, 0, len); ... |
String | inputStream2String(InputStream in) input Stream String StringBuffer sb = new StringBuffer(); InputStreamReader isr = new InputStreamReader(in); BufferedReader reader = new BufferedReader(isr); try { String line; line = reader.readLine(); while (line != null) { sb.append(line); ... |
String | stream2String(InputStream is, int maxLength) Read a String of up to maxLength bytes from an InputStream. byte[] buffer = new byte[4096]; StringWriter sw = new StringWriter(); int totalRead = 0; int read = 0; do { sw.write(new String(buffer, 0, read)); totalRead += read; read = is.read(buffer, 0, buffer.length); ... |
String | fromStream(InputStream stream) Read the whole stream into a string. if (null == stream) { return null; final StringBuilder sb = new StringBuilder(); final BufferedReader br = new BufferedReader(new InputStreamReader( stream), 256); String line; while (true) { ... |
String | toConvertString(InputStream is) to Convert String StringBuffer res = new StringBuffer(); InputStreamReader isr = new InputStreamReader(is); BufferedReader read = new BufferedReader(isr); try { String line; line = read.readLine(); while (line != null) { res.append(line); ... |