/** * Reads the input stream until end-of-input and writes all data to the output stream. Closes none of the two * streams. * * @return The number of bytes copied */ public static long copy(InputStream inputStream, OutputStream outputStream) throws IOException { return IoUtil.copy(inputStream, outputStream, Long.MAX_VALUE); }
@Override public void run() throws IOException { IoUtil.copy(in, out); } };
/** * Reads the reader until end-of-input and writes all data to the writer. Closes neither the reader nor the writer. * * @return The number of characters copied */ public static long copy(Reader reader, Writer writer) throws IOException { return IoUtil.copy(reader, false, writer, false); }
/** * Reads the reader until end-of-input and writes all data to the writer. Closes neither the reader nor the writer. * * @return The number of characters copied */ public static long copy(Reader reader, Writer writer) throws IOException { return IoUtil.copy(reader, false, writer, false); }
/** * Reads the reader until end-of-input and writes all data to the output stream. Closes neither the reader nor the * output stream. * * @return The number of characters copied */ public static long copy(Reader reader, OutputStream outputStream, Charset charset) throws IOException { return IoUtil.copy(reader, new OutputStreamWriter(outputStream, charset)); }
@Override public void consume(Socket dataSocket) throws IOException { long count = IoUtil.copy(dataSocket.getInputStream(), os); LOGGER.fine(count + " bytes received"); } });
@Override public void consume(Socket dataSocket) throws IOException { long count = IoUtil.copy(dataSocket.getInputStream(), os); LOGGER.fine(count + " bytes received"); } });
/** * @return All bytes that the given {@link InputStream} produces */ public static byte[] readAll(InputStream is) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); IoUtil.copy(is, baos); return baos.toByteArray(); }
@Override public void write(OutputStream stream) throws IOException { InputStream in3 = this.in2; if (in3 == null) { throw new IllegalStateException("Body has been read before"); } IoUtil.copy(in3, stream); try { in3.close(); } catch (Exception e) {} this.in2 = null; }
@Override public void consume(Socket dataSocket) throws IOException { long count = IoUtil.copy(is, dataSocket.getOutputStream()); LOGGER.fine(count + " bytes sent"); } });
@Override public void write(OutputStream stream) throws IOException { InputStream in3 = this.in2; if (in3 == null) throw new IllegalStateException(); IoUtil.copy(in3, stream); try { in3.close(); } catch (Exception e) {} this.in2 = null; }
@Override public void readAll(Reader in) throws IOException { IoUtil.copy(in, this.resource.getOutputStream(), Charset.defaultCharset()); } }
@Override public long suck(InputStream in) throws IOException { pis.setDelegate(in); return IoUtil.copy(r, w); }
@Override @Nullable public Void call() throws Exception { for (Reader reader : readers) { IoUtil.copy(reader, writer); } return null; } });
@Override public void consume(NameAndContents nac) throws IOException { IoUtil.copy(nac.open(), true, new File(outputDirectory, nac.getName())); } }
@Override public void consume(NameAndContents nac) throws IOException { IoUtil.copy(nac.open(), true, new File(outputDirectory, nac.getName())); } }
@Override public void drain(InputStream is) throws IOException { tae.setSize(this.count); archiveOutputStream.putArchiveEntry(tae); IoUtil.copy(is, archiveOutputStream); archiveOutputStream.closeArchiveEntry(); } });
@Override public void drain(InputStream is) throws IOException { archiveOutputStream.putArchiveEntry(new CpioArchiveEntry(name, this.count)); IoUtil.copy(is, archiveOutputStream); archiveOutputStream.closeArchiveEntry(); } });
@Override public void drain(InputStream is) throws IOException { tae.setSize(this.count); archiveOutputStream.putArchiveEntry(tae); IoUtil.copy(is, archiveOutputStream); archiveOutputStream.closeArchiveEntry(); } });
@Override public void drain(InputStream is) throws IOException { archiveOutputStream.putArchiveEntry(new CpioArchiveEntry(name, this.count)); IoUtil.copy(is, archiveOutputStream); archiveOutputStream.closeArchiveEntry(); } });