Copy the reader to the output stream
343722
public static void copyReader(OutputStream outs, Reader reader) throws IOException
   {
      try
      {
         OutputStreamWriter writer = new OutputStreamWriter(outs, StandardCharsets.UTF_8);
         char[] bytes = new char[1024];
         int r = reader.read(bytes);
         while (r > 0)
         {
            writer.write(bytes, 0, r);
            r = reader.read(bytes);
         }
      }
      catch (IOException e)
      {
         throw e;
      }
      finally{
         reader.close();
      }
   }
691644
private static void copy(InputStream source, OutputStream sink) throws IOException {
        byte[] buf = new byte[8192];
        int n;
        while ((n = source.read(buf)) > 0) {
            sink.write(buf, 0, n);
        }
    }
1012745
protected void copyStreams(InputStream is, OutputStream os) throws IOException {
        byte[] buffer = new byte[1024];
        try {
            int read;
            while ((read = is.read(buffer)) != -1) {
                os.write(buffer, 0, read);
                buffer = new byte[1024];
            }
        } finally {
            if (null != os)
                os.close();
            if (null != is)
                is.close();
        }
    }
74542
function copy(from, to){
  to = to || from;
  from = path.join(tpl, from);
  fs.createReadStream(from).pipe(fs.createWriteStream(to));
}
784226
public static void copy(String in, Charset charset, OutputStream out) throws IOException {
		Assert.notNull(in, "No input String specified");
		Assert.notNull(charset, "No charset specified");
		Assert.notNull(out, "No OutputStream specified");
		Writer writer = new OutputStreamWriter(out, charset);
		writer.write(in);
		writer.flush();
	}
502828
public static int copyAndCloseOutput(Reader input, Writer output) throws IOException {
		try {
			return copy(input, output);
		} finally {
			output.close();
		}
		
	}
57473
public static void copy(byte[] in, OutputStream out) throws IOException {
		Assert.notNull(in, "No input byte array specified");
		Assert.notNull(out, "No OutputStream specified");
		out.write(in);
	}
635768
def copy(self):
    
    a, b = it.tee(self._data) # 2 generators, not thread-safe
    self._data = a
    return Stream(b)
1153363
public static void copy(InputStream source, OutputStream destination) throws IOException
    {
        Check.notNull(source);
        Check.notNull(destination);

        final byte[] buffer = new byte[BUFFER_COPY];
        while (true)
        {
            final int read = source.read(buffer);
            if (read == -1)
            {
                break;
            }
            destination.write(buffer, 0, read);
        }
    }
218901
static public void copyStream(InputStream is, OutputStream os, int transferBufferSize) throws IOException {
		if( transferBufferSize < 1 ) {
			throw new IOException("Transfer buffer size can not be smaller than 1");
		}

		byte[] buffer = new byte[transferBufferSize];

		int bytesRead = is.read(buffer);
		while( bytesRead >= 0 ) {
			os.write(buffer, 0, bytesRead);

			bytesRead = is.read(buffer);
		}
	}
25403
public static void copyStream(InputStream is, OutputStream os, int bufferSize)
            throws IOException {
        if (is == null) {
            throw MESSAGES.nullArgument("input stream");
        }
        if (os == null) {
            throw MESSAGES.nullArgument("output stream");
        }
        byte[] buff = new byte[bufferSize];
        int rc;
        while ((rc = is.read(buff)) != -1) { os.write(buff, 0, rc); }
        os.flush();
    }
100606
public static long copy(InputStream input, OutputStream output) throws IOException {
        byte[] buffer = new byte[2 * 1024];
        long total = 0;
        int count;
        while ((count = input.read(buffer)) != -1) {
            output.write(buffer, 0, count);
            total += count;
        }

        return total;
    }
1007461
private void copy( final InputStream is, final OutputStream os ) throws IOException
   {
      final byte[] buffer = new byte[ 512 ];
      int countOfBytes = -1;

      while ( !this.terminated )
      {
         while ( is.available() <= 0 )
         {
            synchronized( this )
            {
               try
               {
                  this.wait( 50 ); // guard
                  if ( this.terminated ) return;
               }
               catch ( InterruptedException ie )
               {
                  log.error(ie);
               }
            }
         }

         countOfBytes = is.read( buffer, 0, buffer.length );
         os.write( buffer, 0, countOfBytes );
      }
   }
1360700
private static void copyStream(Reader r, Writer w) throws IOException {
        char[] buffer = new char[4096];
        for (int n = 0; -1 != (n = r.read(buffer));) {
            w.write(buffer, 0, n);
        }
    }
382960
public static void copy(InputStream source, File destination) throws IOException {
        OutputStream output = null;

        try {
            output = new FileOutputStream(destination);
            copy(source, output);
        } finally {
            closeQuietly(output);
        }
    }
895690
private static final void copy(Reader r, Writer w, int blockSize, long timeout) throws IOException {
	if (timeout < 1) {
	    char[] buffer = new char[blockSize];
	    int len;

	    while ((len = r.read(buffer)) != -1)
		w.write(buffer, 0, len);
	}
	else {
	    Copy c = new Copy(r, w, blockSize, timeout);
	    c.start();

	    try {
		synchronized (c.notifier) {// print.err(timeout);
		    c.notifier.wait(timeout + 1);
		}
	    }
	    catch (InterruptedException ie) {
		throw ExceptionUtil.toIOException(c.t);
	    }
	    if (c.t != null) throw ExceptionUtil.toIOException(c.t);
	    if (!c.finished) throw new IOException("reached timeout (" + timeout + "ms) while copying data");

	}
    }
973450
public static void copyStream(final InputStream src, OutputStream dest) throws IOException {
        byte[] buffer = new byte[1024];
        int read;
        while ((read = src.read(buffer)) > -1) {
            dest.write(buffer, 0, read);
        }
        dest.flush();
    }