List of utility methods to do InputStream to OutputStream
void | copyStream(InputStream input, OutputStream output) Copy the data from an InputStream to an OutputStream without closing the stream. copyStream(input, output, DEFAULT_BUFFER_SIZE); |
void | copyStream(InputStream input, OutputStream output) Copies the contents of the InputStream into the OutputStream .
try { byte[] bytes = new byte[4096]; int bytesRead = 0; while ((bytesRead = input.read(bytes)) >= 0) { output.write(bytes, 0, bytesRead); } catch (IOException e) { throw new RuntimeException(e); ... |
void | copyStream(InputStream input, OutputStream output) copy Stream byte[] buf = new byte[8192]; int len; try { while ((len = input.read(buf)) > 0) { output.write(buf, 0, len); } catch (IOException x) { if (!x.getMessage().equals("Unexpected compressed block length: 1")) { ... |
void | copyStream(InputStream input, OutputStream output) Allocates a #DEFAULT_BUFFER_SIZE byte[] for use as a temporary buffer and calls #copyStream(InputStream,OutputStream,byte[]) . copyStream(input, output, new byte[DEFAULT_BUFFER_SIZE]); |
int | copyStream(InputStream input, OutputStream output) copy Stream byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int count = 0; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); count += n; return count; ... |
long | copyStream(InputStream input, OutputStream output, boolean closeStreams) Copies one stream to another, optionally closing the streams. long numBytesCopied = 0; int bufferSize = 32768; try { input = new BufferedInputStream(input, bufferSize); byte[] buffer = new byte[bufferSize]; for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) { output.write(buffer, 0, bytesRead); numBytesCopied += bytesRead; ... |
long | copyStream(InputStream input, OutputStream output, boolean closeStreams) Copies one stream to another, optionally closing the streams. long numBytesCopied = 0; int bufferSize = BUFFER_SIZE; try { input = new BufferedInputStream(input, bufferSize); byte[] buffer = new byte[bufferSize]; for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) { output.write(buffer, 0, bytesRead); numBytesCopied += bytesRead; ... |
void | copyStream(InputStream input, OutputStream output, int bufferSize) copy Stream try { byte[] buf = new byte[bufferSize]; int len; while ((len = input.read(buf)) > 0) { output.write(buf, 0, len); } finally { if (input != null) { ... |
void | copyStream(InputStream input, OutputStream output, int length) copy Stream byte[] buffer = new byte[length]; int remaining = length; int bytesRead; while ((bytesRead = input.read(buffer, 0, remaining)) != -1 && remaining > 0) { output.write(buffer, 0, bytesRead); remaining -= bytesRead; |
void | copyStream(InputStream inputStream, OutputStream outputStream) Copies all bytes in given inputStream (until EOF) to given outputStream. copyStream(inputStream, outputStream, true); |