List of utility methods to do InputStream Copy
void | copyStream(Reader in, Writer out) copy Stream char[] buffer = new char[2048]; int nread; int col = 0; try { nread = in.read(buffer); while (nread > 0) { out.write(buffer, 0, nread); nread = in.read(buffer); ... |
void | copyStream(Reader in, Writer out) Copies all data from one Reader to another Writer. char[] buff = new char[8192]; int len; while ((len = in.read(buff)) > 0) { out.write(buff, 0, len); |
void | copyStream(Reader reader, Writer writer) copy Stream int len; char[] buffer = new char[1024]; while ((len = reader.read(buffer)) >= 0) { writer.write(buffer, 0, len); |
byte[] | copyStream(ZipInputStream in, ZipEntry entry) copy Stream ByteArrayOutputStream out = new ByteArrayOutputStream(); int size; byte[] buffer = new byte[2048]; BufferedOutputStream bos = new BufferedOutputStream(out); while ((size = in.read(buffer, 0, buffer.length)) != -1) { bos.write(buffer, 0, size); bos.flush(); ... |
byte[] | copyStreamBytes(InputStream is) copy Stream Bytes byte[] buffer = new byte[1024]; ByteArrayOutputStream bos = new ByteArrayOutputStream(); int len; while ((len = is.read(buffer, 0, buffer.length)) >= 0) { bos.write(buffer, 0, len); return bos.toByteArray(); |
int | copyStreamToByteArray(InputStream in, byte[] dest, int off, int len) Reads up to len bytes from in and writes them to dest starting with off .
int r = 0; while (r < len) { int n = in.read(dest, off + r, len - r); if (n > 0) { r += n; } else if (n == -1) { break; } else { ... |
byte[] | copyStreamToBytes(InputStream inputStream) copy Stream To Bytes requireNonNull(inputStream); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); copyStream(inputStream, byteArrayOutputStream); return byteArrayOutputStream.toByteArray(); |
String | copyStreamToString(InputStream input) Calls #copyStreamToString(InputStream,int,String) using the input's InputStream#available() available size and the platforms's default charset. return copyStreamToString(input, input.available(), null);
|
String | copyStreamToString(InputStream input) Copy the data from an InputStream to a string using the default charset without closing the stream. return copyStreamToString(input, input.available());
|
String | copyStreamToString(InputStream input) Copy the data from an InputStream to a string using the default charset without closing the stream. return copyStreamToString(input, input.available());
|