List of utility methods to do InputStream Copy
String | copyStreamToString(InputStream inputStream, String encoding) Copies data from the input stream and returns a String (UTF-8 if not specified) encoding = (encoding == null) ? "UTF-8" : encoding; ByteArrayOutputStream baos = new ByteArrayOutputStream(); copyStream(inputStream, baos); return baos.toString(encoding); |
void | copyStreamToWriter(InputStream in, Writer out, String encoding, boolean close) Copies an InputStream to a Writer. InputStreamReader reader = new InputStreamReader(in, encoding);
copyReaderToWriter(reader, out, close);
|
void | copyStreamToWriter(InputStream inStream, Writer writer) Copies contents of inStream to writer. int data = -1; while ((data = inStream.read()) != -1) { writer.write(data); |