List of utility methods to do InputStream to String Convert
String | readIt(InputStream stream) Reads an InputStream as an UTF-8 string BufferedReader br = new BufferedReader( new InputStreamReader(stream)); StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { sb.append(line + "\n"); br.close(); ... |
String | inputStream2String(InputStream inputStream) input Stream String if (inputStream == null) { return null; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int count = 0; while ((count = inputStream.read(buffer)) >= 0) { outputStream.write(buffer, 0, count); ... |
String | InputStreamTOString(InputStream in) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "ISO-8859-1"); |
String | InputStreamTOString(InputStream in) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "ISO-8859-1"); |
String | InputStreamTOString(InputStream in) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray()); |
String | InputStreamTOString(InputStream in) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "ISO-8859-1"); |
String | InputStreamTOString(InputStream in) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "UTF-8"); |
String | InputStreamTOString(InputStream in) InputStream to String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) { outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "ISO-8859-1"); ... |
String | InputStreamTOString(InputStream in, String encoding) Input Stream TO String if (in == null) { return ""; try { StringBuilder sb = new StringBuilder(); String line; BufferedReader reader = new BufferedReader( new InputStreamReader(in, encoding)); ... |
String | InputStreamTOString(InputStream in, String encoding) Input Stream TO String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); byte[] data = new byte[BUFFER_SIZE]; int count = -1; while ((count = in.read(data, 0, BUFFER_SIZE)) != -1) outStream.write(data, 0, count); data = null; return new String(outStream.toByteArray(), "ISO-8859-1"); |