Copy data from another file instance.

        :param src: Source stream.
        :param chunk_size: Chunk size to read from source stream.
500356
def copy(self, src, chunk_size=None, progress_callback=None):
        
        fp = src.open(mode='rb')
        try:
            return self.save(
                fp, chunk_size=chunk_size, progress_callback=progress_callback)
        finally:
            fp.close()
761706
def multiple_chunks(self, chunk_size=None):
        
        if not chunk_size:
            chunk_size = self.DEFAULT_CHUNK_SIZE
        return self.size > chunk_size
29476
function copyFile(srcPath, desPath) {
    var read = fs.createReadStream(srcPath);
    var write = fs.createWriteStream(desPath);
    read.pipe(write);
    console.log('[info] create file:', desPath);
}
3202
def chunk(self, size=0):
        

        if size == 0:
            raise ValueError('Invalid chunk size')

        self.__prepare()
        _new_content = []

        while(len(self._json_data) > 0):
            _new_content.append(self._json_data[0:size])
            self._json_data = self._json_data[size:]

        self._json_data = _new_content

        return self._json_data
305327
def copy_remote_file(web_file, destination):
    
    size = 0
    dir_name = os.path.dirname(destination)
    if not os.path.exists(dir_name):
        os.makedirs(dir_name)

    with open(destination, 'wb') as file_:
        chunk_size = 8 * 1024
        for chunk in web_file.iter_content(chunk_size=chunk_size):
            if chunk:
                file_.write(chunk)
                size += len(chunk)
    return size
1277775
public static Object copy(Object src, Object dest, int length) {
		System.arraycopy(src, 0, dest, 0, length);
		return dest;
	}
651947
def stream_download(self, chunk_size: Optional[int] = None, callback: Optional[Callable] = None) -> AsyncIterator[bytes]:
        
        pass
199244
def chunk(self, size):
        
        chunks = self._chunk(size)

        return self.__class__(list(map(self.__class__, chunks)))
922115
def copy(self, src, dst, other_system=None):
        
        copy_source = self.get_client_kwargs(src)
        copy_destination = self.get_client_kwargs(dst)
        with _handle_client_error():
            self.client.copy_object(CopySource=copy_source, **copy_destination)
504720
def copy(self, src, dst, other_system=None):
        
        copy_source = self.get_client_kwargs(src)
        copy_destination = self.get_client_kwargs(dst)
        with _handle_oss_error():
            bucket = self._get_bucket(copy_destination)
            bucket.copy_object(
                source_bucket_name=copy_source['bucket_name'],
                source_key=copy_source['key'],
                target_key=copy_destination['key'])
438282
def download(url, target_file, chunk_size=4096):
    
    r = requests.get(url, stream=True)

    with open(target_file, 'w+') as out:
        # And this is why I love Armin Ronacher:
        with click.progressbar(r.iter_content(chunk_size=chunk_size),
                               int(r.headers['Content-Length'])/chunk_size,
                               label='Downloading...') as chunks:
            for chunk in chunks:
                out.write(chunk)
1296017
def copyto(self, src, where=None):
        
        for n, _ in enumerate(self.l):
            if where[n]:
                self.l[n] = src.l[n]
224764
public static int copyWsByteBuffer(WsByteBuffer src, WsByteBuffer dst, int amount)
   {
      int amountCopied = amount;
      int dstRemaining = dst.remaining();
      int srcRemaining = src.remaining();

      if (amountCopied > dstRemaining) amountCopied = dstRemaining;
      if (amountCopied > srcRemaining) amountCopied = srcRemaining;

      if (amountCopied > 0)
      {
         int srcLimit = src.limit();
         src.limit(src.position()+amountCopied);
         dst.put(src);
         src.limit(srcLimit);
      }

      return amountCopied;
   }
498492
def write_stream(src_file, destination_path):
    
    with open(destination_path, 'wb') as destination_file:
        shutil.copyfileobj(fsrc=src_file, fdst=destination_file)
1217610
@SuppressWarnings("resource")
	public static void copy(File src, File dst) throws IOException {

		// Took following recipe from
		// http://stackoverflow.com/questions/106770/standard-concise-way-to-copy-a-file-in-java
		// The nio package seems to be the most efficient way to copy a file
		FileChannel source = null;
		FileChannel destination = null;

		try {
			// we need the supress warnings here (the warning that the stream is not closed is harmless)
			// see http://stackoverflow.com/questions/12970407/does-filechannel-close-close-the-underlying-stream
			source = new FileInputStream(src).getChannel();
			destination = new FileOutputStream(dst).getChannel();
			destination.transferFrom(source, 0, source.size());
		} finally {
			if (source != null) {
				source.close();
			}
			if (destination != null) {
				destination.close();
			}
		}
	}
880780
private void copy(StaplerRequest req, StaplerResponse rsp, File dir, URL src, String name) throws ServletException, IOException {
        try {
            FileUtils.copyURLToFile(src,new File(dir, name));
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Failed to copy "+name,e);
            sendError("Failed to copy "+name+": "+e.getMessage(),req,rsp);
            throw new AbortException();
        }
    }
947576
def copy(src, trg, transform=None):
    ''' 
    '''
    source = open(src[0], src[1])
    target = open(trg[0], trg[1], autocommit=1000)

    for item in source.get():
        item = dict(item)
        if '_id' in item:
            del item['_id']

        if transform:
            item = transform(item)
        target.put(trg[0](item))

    source.close()
    target.commit()
    target.close()