Alias of {@link #copy(InputStream, OutputStream, boolean)}
196654
public static int write(InputStream is, OutputStream os, boolean closeSink) {
        return copy(is, os, closeSink);
    }
391646
public static void copy(InputStream is, Resource out, boolean closeIS) throws IOException {
	OutputStream os = null;
	try {
	    os = toBufferedOutputStream(out.getOutputStream());
	}
	catch (IOException ioe) {
	    IOUtil.closeEL(os);
	    throw ioe;
	}
	copy(is, os, closeIS, true);
    }
239171
public static void copy(URL from, OutputStream to) throws IOException {
        try (InputStream inputStream = from.openStream()) {
            ByteStreams.copy(inputStream, to);
        }
    }
1037247
public static void copy(HttpServletRequest req, OutputStream output) throws IOException {
        InputStream input = req.getInputStream();
        int availableBytes = req.getContentLength();
        log.debug("copy - available: {}", availableBytes);
        if (availableBytes > 0) {
            byte[] buf = new byte[availableBytes];
            int bytesRead = input.read(buf);
            while (bytesRead != -1) {
                output.write(buf, 0, bytesRead);
                bytesRead = input.read(buf);
                log.trace("Bytes read: {}", bytesRead);
            }
            output.flush();
        } else {
            log.debug("Nothing to available to copy");
        }
    }
43858
public static void copyStream(InputStream copyFrom, OutputStream copyTo,
			GeoPackageProgress progress) throws IOException {

		try {
			byte[] buffer = new byte[1024];
			int length;
			while ((progress == null || progress.isActive())
					&& (length = copyFrom.read(buffer)) > 0) {
				copyTo.write(buffer, 0, length);
				if (progress != null) {
					progress.addProgress(length);
				}
			}

			copyTo.flush();
		} finally {
			closeQuietly(copyTo);
			closeQuietly(copyFrom);
		}

	}
712402
public static int copy(InputStream in, OutputStream out) throws IOException {
        assert in != null : "No input stream specified";
        assert out != null : "No output stream specified";
        try {
            int byteCount = 0;
            byte[] buffer = new byte[BUFFER_SIZE];
            int bytesRead = -1;
            while ((bytesRead = in.read(buffer)) != -1) {
                out.write(buffer, 0, bytesRead);
                byteCount += bytesRead;
            }
            out.flush();
            return byteCount;
        } finally {
            try {
                in.close();
            } catch (IOException ex) {
            }
            try {
                out.close();
            } catch (IOException ex) {
            }
        }
    }
1261971
private void copydata(InputStream in, OutputStream out) throws java.io.IOException
    {
        long timestamp= 0;
        long byteCount = 0;
        while (true)
        {
            try
            {
                byteCount = copyBytes(in, out,-1);
                timestamp= 0;
                if (byteCount == -1) {
                    return;
                }
            }
            catch (InterruptedIOException e)
            {
                LogSupport.ignore(log, e);
                if (timestamp == 0)
                    timestamp= System.currentTimeMillis();
                else if (_timeoutMs > 0 && (System.currentTimeMillis() - timestamp) > _timeoutMs)
                    throw e;
            }
        }
    }
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();
    }
29307
public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException {
		return copy(in, out, bufferSize, null);
	}
407163
public long copyTo(ByteSink sink) throws IOException {
    checkNotNull(sink);

    Closer closer = Closer.create();
    try {
      InputStream in = closer.register(openStream());
      OutputStream out = closer.register(sink.openStream());
      return ByteStreams.copy(in, out);
    } catch (Throwable e) {
      throw closer.rethrow(e);
    } finally {
      closer.close();
    }
  }
416734
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
    LOGGER.trace("copy(InputStream, OutputStream)");
    copy(inputStream, outputStream, new byte[BUFFER_SIZE]);
  }
1121577
private void copy(InputStream input, OutputStream output) throws IOException {
    try {
      byte[] buffer = new byte[BUFFER_SIZE];
      int bytesRead = input.read(buffer);
      while (bytesRead != -1) {
        output.write(buffer, 0, bytesRead);
        bytesRead = input.read(buffer);
      }
    } finally {
      input.close();
      output.close();
    }
  }
739021
public static void copyStream(InputStream copyFrom, File copyTo,
			GeoPackageProgress progress) throws IOException {

		OutputStream to = new FileOutputStream(copyTo);

		copyStream(copyFrom, to, progress);

		// Try to delete the file if progress was cancelled
		if (progress != null && !progress.isActive()
				&& progress.cleanupOnCancel()) {
			copyTo.delete();
		}
	}
726491
public static boolean copy(File source, File output){

        // Check to see if output exists
        if(output.exists() && output.canWrite()){
            // Delete the existing file, and create a new one
            if(output.delete()) {
                try {
                    output.createNewFile();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }else if(!output.exists()){
            try {
                output.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        // now that we have performed a prelimanary check on the output, time to copy
        if(source.exists() && source.canRead()){

            try {
                FileInputStream fis = new FileInputStream(source);
                FileOutputStream fos = new FileOutputStream(output);
                byte[] buffer = new byte[1024];

                int len=0;
                while((len=fis.read(buffer)) > 0){
                    fos.write(buffer, 0, len);
                }

                fis.close();
                fos.close();

                return true;
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

        return false;
    }
574150
public void copy(Datastream target) {

        target.isNew = isNew;
        target.DatastreamID = DatastreamID;
        if (DatastreamAltIDs != null) {
            target.DatastreamAltIDs = new String[DatastreamAltIDs.length];
            for (int i = 0; i < DatastreamAltIDs.length; i++) {
                target.DatastreamAltIDs[i] = DatastreamAltIDs[i];
            }
        }
        target.DSFormatURI = DSFormatURI;
        target.DSMIME = DSMIME;
        target.DSControlGrp = DSControlGrp;
        target.DSInfoType = DSInfoType;
        target.DSState = DSState;
        target.DSVersionable = DSVersionable;
        target.DSVersionID = DSVersionID;
        target.DSLabel = DSLabel;
        target.DSCreateDT = DSCreateDT;
        target.DSSize = DSSize;
        target.DSLocation = DSLocation;
        target.DSLocationType = DSLocationType;
        target.DSChecksumType = DSChecksumType;
        target.DSChecksum = DSChecksum;
    }
1099153
public static void copy(InputStream in, OutputStream out, long count)
			throws IOException {
		copy(in, out, count, BUFFER_SIZE);
	}
224602
public static void copyStream(InputStream from, OutputStream to) throws IOException {
        byte buffer[] = new byte[2048];
        int bytesRead;
        while ((bytesRead = from.read(buffer)) != -1) {
            to.write(buffer, 0, bytesRead);
        }
        from.close();
    }