List of utility methods to do InputStream to OutputStream
void | copyStream(@Nonnull InputStream in, @Nonnull OutputStream out) copy Stream byte[] buf = new byte[8192]; int len; while ((len = in.read(buf)) >= 0) out.write(buf, 0, len); |
void | copyStream(ByteArrayOutputStream source, ByteArrayOutputStream target) Copies source stream to target. ByteArrayOutputStream memContentStream = source; if (memContentStream != null) { memContentStream.writeTo(target); memContentStream.flush(); } else { int c; ByteArrayInputStream inStream = new ByteArrayInputStream(source.toByteArray()); while ((c = inStream.read()) != -1) { ... |
void | copyStream(final InputStream in, final OutputStream out) Copies the contents of a stream to another. int bytesRead; byte[] b = new byte[10000]; while ((bytesRead = in.read(b)) != -1) { out.write(b, 0, bytesRead); out.flush(); |
void | copyStream(final InputStream in, final OutputStream out) Copy stream. final byte[] bytes = new byte[8192]; int cnt; while ((cnt = in.read(bytes)) != -1) { out.write(bytes, 0, cnt); |
void | copyStream(final InputStream in, final OutputStream out, final int bufferSize) Copies the contents of an java.io.InputStream to an java.io.OutputStream , using buffer size provided. final byte[] buffer = new byte[bufferSize]; int byteRead = 0; while ((byteRead = in.read(buffer)) >= 0) { out.write(buffer, 0, byteRead); |
int | copyStream(final InputStream in, final OutputStream out, int iMax) copy Stream if (iMax < 0) iMax = Integer.MAX_VALUE; final byte[] buf = new byte[8192]; int byteRead = 0; int byteTotal = 0; while ((byteRead = in.read(buf, 0, Math.min(buf.length, iMax - byteTotal))) > 0) { out.write(buf, 0, byteRead); byteTotal += byteRead; ... |
void | copyStream(final InputStream input, final OutputStream output, long count) Copies count bytes from input to output. final byte[] buffer = new byte[64 * 1024]; if (count < 0) { int read; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } else { while (count > 0) { ... |
long | copyStream(final InputStream inputStream, final OutputStream out) copy Stream return copyStream(inputStream, out, 10240);
|
void | copyStream(final InputStream inputStream, final OutputStream outputStream) copy Stream final byte[] buffer = new byte[1024 * 4]; int c; while (-1 != (c = inputStream.read(buffer))) { outputStream.write(buffer, 0, c); |
int | copyStream(final InputStream inputStream, final OutputStream outputStream) copy Stream if (inputStream == null) { return 0; int result = 0; final byte[] buf = new byte[DEFAULT_BUFFER_SIZE]; for (;;) { final int numRead = inputStream.read(buf); if (numRead == -1) { ... |