@Override public void write(OutputStream out) throws IOException { IOUtils.copy(stream, out); } });
@Override public void write(OutputStream out) throws IOException { IOUtils.copy(stream, out); } });
/** * Copies all bytes of an input stream to an output stream. * * Neither the input stream nor the output stream will the closed after the * copy. * * @param in * the input stream, must not be {@code null} * @param out * the output stream, must not be {@code null} */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in, out, 64 * 1024); }
/** * Copies all bytes of an input stream to an output stream. * * Neither the input stream nor the output stream will the closed after the * copy. * * @param in * the input stream, must not be {@code null} * @param out * the output stream, must not be {@code null} */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in, out, 64 * 1024); }
/** * Writes a content stream to an output stream. * * If the content stream is {@code null} or the stream itself is * {@code null}, nothing is written to the output stream. The content stream * is closed at the end. The output stream remains open. * * @param contentStream * the content stream, may be {@code null} * @param outputStream * the output stream, not {@code null} */ public static void writeContentStreamToOutputStream(ContentStream contentStream, OutputStream outputStream) throws IOException { if (outputStream == null) { throw new IllegalArgumentException("Output stream is null!"); } if (contentStream == null || contentStream.getStream() == null) { return; } try { IOUtils.copy(contentStream.getStream(), outputStream); } finally { IOUtils.closeQuietly(contentStream); } }
/** * Writes a content stream to an output stream. * * If the content stream is {@code null} or the stream itself is * {@code null}, nothing is written to the output stream. The content stream * is closed at the end. The output stream remains open. * * @param contentStream * the content stream, may be {@code null} * @param outputStream * the output stream, not {@code null} */ public static void writeContentStreamToOutputStream(ContentStream contentStream, OutputStream outputStream) throws IOException { if (outputStream == null) { throw new IllegalArgumentException("Output stream is null!"); } if (contentStream == null || contentStream.getStream() == null) { return; } try { IOUtils.copy(contentStream.getStream(), outputStream); } finally { IOUtils.closeQuietly(contentStream); } }
@Override public ContentStream call() throws Exception { ContentStream contentStream = super.call(); try { if (contentStream != null && contentStream.getStream() != null && target != null) { IOUtils.copy(contentStream.getStream(), target); } } finally { IOUtils.closeQuietly(contentStream); } return contentStream; } }
@Override public ContentStream call() throws Exception { ContentStream contentStream = super.call(); try { if (contentStream != null && contentStream.getStream() != null && target != null) { IOUtils.copy(contentStream.getStream(), target); } } finally { IOUtils.closeQuietly(contentStream); } return contentStream; } }
os = new FileOutputStream(fileName); IOUtils.copy(is, os, BUFSIZE);
writeLine(out); IOUtils.copy(stream, out, BUFFER_SIZE);
writeLine(out); IOUtils.copy(stream, out, BUFFER_SIZE);
OutputStream out = response.getOutputStream(); try { IOUtils.copy(in, out, BUFFER_SIZE); out.flush(); } finally {
OutputStream out = response.getOutputStream(); try { IOUtils.copy(in, out, BUFFER_SIZE); out.flush(); } finally {