List of utility methods to do InputStream to OutputStream
void | copyStream(InputStream inputStream, OutputStream outputStream) copy Stream requireNonNull(inputStream); requireNonNull(outputStream); int n; byte[] buffer = new byte[DEFAULT_BUFFER_CAPACITY]; while ((n = inputStream.read(buffer)) > 0) outputStream.write(buffer, 0, n); |
boolean | copyStream(InputStream inStream, OutputStream outStream) Copy the input stream into the output stream. try { byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = inStream.read(buffer)) >= 0) { outStream.write(buffer, 0, bytesRead); } catch (Exception e) { return false; ... |
void | copyStream(InputStream inStream, OutputStream outStream) copy Stream int readbytes = 0; try { do { byte[] buffer = new byte[512]; readbytes = inStream.read(buffer, 0, 512); if (readbytes <= 0) { break; outStream.write(buffer, 0, readbytes); outStream.flush(); } while (true); } catch (IOException ioE) { ioE.printStackTrace(); } finally { if (inStream != null) { inStream.close(); if (outStream != null) { outStream.close(); |
void | copyStream(InputStream is, OutputStream os) Copies all data, one byte at a time from the specified InputStream to the specified OutputStream until EOF is reached. for (int b = is.read(); b >= 0; b = is.read()) { os.write(b); os.flush(); |
void | copyStream(InputStream is, OutputStream os) copy Stream byte[] buf = new byte[4096]; BufferedInputStream bis = new BufferedInputStream(is); BufferedOutputStream bos = new BufferedOutputStream(os); int s; try { while ((s = bis.read(buf)) > 0) { bos.write(buf, 0, s); } finally { try { bos.flush(); } catch (Exception var11) { ; |
void | copyStream(InputStream is, OutputStream os) copy Stream copyStream(is, os, true, true); |
void | copyStream(InputStream is, OutputStream os) copy Stream if (is == null) { throw new IllegalArgumentException("InputStream is null"); if (os == null) { throw new IllegalArgumentException("OutputStream is null"); byte[] b = new byte[DEFAULT_BUFFER_SIZE]; int len = 0; ... |
int | copyStream(InputStream is, OutputStream os) Copy an InputStream to an OutputStream. return copyStream(is, os, -1);
|
void | copyStream(InputStream is, OutputStream os) copy Stream byte[] buf = new byte[8192]; int rc; try (InputStream input = is) { while ((rc = input.read(buf)) != -1) { os.write(buf, 0, rc); } catch (Exception e) { throw new RuntimeException("Failed to read/write a stream: ", e); ... |
void | copyStream(InputStream is, OutputStream os) copy Stream try { byte buf[] = new byte[8192]; int rd = -1; while ((rd = is.read(buf)) != -1) os.write(buf, 0, rd); } catch (Exception e) { throw new RuntimeException("Stream copy failed", e); } finally { ... |