Copies the range (in bytes) between fileStart and fileEnd to the given
    output file handle.
977111
def copy_subrange_of_file(input_file, file_start, file_end, output_filehandle):
    
    with open(input_file, 'r') as fileHandle:
        fileHandle.seek(file_start)
        data = fileHandle.read(file_end - file_start)
        assert len(data) == file_end - file_start
        output_filehandle.write(data)
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();
		}
	}
958333
def copyfileobj(src, dst, length=None):
    
    if length == 0:
        return
    if length is None:
        while True:
            buf = src.read(16*1024)
            if not buf:
                break
            dst.write(buf)
        return

    BUFSIZE = 16 * 1024
    blocks, remainder = divmod(length, BUFSIZE)
    for b in range(blocks):
        buf = src.read(BUFSIZE)
        if len(buf) < BUFSIZE:
            raise IOError("end of file reached")
        dst.write(buf)

    if remainder != 0:
        buf = src.read(remainder)
        if len(buf) < remainder:
            raise IOError("end of file reached")
        dst.write(buf)
    return
128823
public static int copyAndCloseBoth(Reader input, Writer output) throws IOException {
		try {
			return copyAndCloseOutput(input, output);
		} finally {
			input.close();
		}
	}
361616
def lrange(self, name, start, end):
        
        return self.execute_command('LRANGE', name, start, end)
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);
		}

	}
1067283
public static long copy(
                    final Reader input,
                    final Writer output
                    )
    throws IOException
    {
        _LOG_.debug( "begin copy" );

        @SuppressWarnings( "resource" )
        BufferedReader  b_input = (BufferedReader.class.isInstance( input )
                                    ? BufferedReader.class.cast( input )
                                    : new BufferedReader( input ));
        @SuppressWarnings( "resource" )
        BufferedWriter  b_output = (BufferedWriter.class.isInstance( output )
                        ? BufferedWriter.class.cast( output )
                        : new BufferedWriter( output ));

        char[]  buffer = new char[512];
        long  size = 0;
        try {
            while (true) {
                int  n = b_input.read( buffer );
                               //@throws IOException
                if (n == -1) {
                    break;
                }
                b_output.write( buffer, 0, n );
                       //@throws IOException
                size += n;
            }
        } finally {
            try {
                b_output.flush();
            } catch (Exception ex) {
                //ignorable
            }
        }

        _LOG_.debug( "end copy: #bytes=" + size );
        return size;
    }
903870
public static ByteBuffer copy(ByteBuffer src, int start, int end) {
		return copy(src, ByteBuffer.allocate(end - start));
	}
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;
    }
1282294
function fileToOutput(output, filePath) {
    var book = output.getBook();
    var readme = book.getReadme();
    var fileReadme = readme.getFile();

    if (
        path.basename(filePath, path.extname(filePath)) == 'README' ||
        (fileReadme.exists() && filePath == fileReadme.getPath())
    ) {
        filePath = path.join(path.dirname(filePath), 'index' + OUTPUT_EXTENSION);
    } else {
        filePath = PathUtils.setExtension(filePath, OUTPUT_EXTENSION);
    }

    return LocationUtils.normalize(filePath);
}
309684
def send_range_for_local_file
        _, range = request.headers['Range'].split('bytes=')
        from, to = range.split('-').map(&:to_i)
        to = local_file_size - 1 unless to
        length = to - from + 1
        response.headers['Content-Range'] = "bytes #{from}-#{to}/#{local_file_size}"
        response.headers['Content-Length'] = length.to_s
        self.status = 206
        prepare_local_file_headers
        # For derivatives stored on the local file system
        send_data IO.binread(file, length, from), local_derivative_download_options.merge(status: status)
      end
52385
public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
    IOUtils.copyLarge(in, out, r.start, r.length);
  }
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;
   }
914322
public static int copyFile(String from, String to) {
		InputStream inStream = null;
		FileOutputStream fs = null;
		try {
			int bytesum = 0;
			int byteread;
			File oldfile = new File(from);
			if (oldfile.exists()) {
				inStream = new FileInputStream(from);
				fs = new FileOutputStream(to);
				byte[] buffer = new byte[1444];
				while ((byteread = inStream.read(buffer)) != -1) {
					bytesum += byteread;
					fs.write(buffer, 0, byteread);
				}
			}
			return bytesum;
		} catch (Exception e) {
			return 0;
		} finally {
			Util.ensureClosed(inStream);
			Util.ensureClosed(fs);
		}
	}
1167035
def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None):
    
    if bufsize is None:
        bufsize = pipebuf.PIPE_BUF_BYTES

    if length == 0:
        return
    if length is None:
        shutil.copyfileobj(src, dst, bufsize)
        return

    blocks, remainder = divmod(length, bufsize)
    for b in range(blocks):
        buf = src.read(bufsize)
        if len(buf) < bufsize:
            raise exception("unexpected end of data")
        dst.write(buf)

    if remainder != 0:
        buf = src.read(remainder)
        if len(buf) < remainder:
            raise exception("unexpected end of data")
        dst.write(buf)
    return
89402
def stream_copy(source, destination, chunk_size=512 * 1024):
    """"""
    br = 0
    while True:
        chunk = source.read(chunk_size)
        destination.write(chunk)
        br += len(chunk)
        if len(chunk) < chunk_size:
            break
    # END reading output stream
    return br
316386
private void copy(final WritableByteChannel target,
        final byte[] boundary, final ReadableByteChannel body)
        throws IOException {
        int match = 0;
        boolean cont = true;
        while (cont) {
            if (!this.buffer.hasRemaining()) {
                this.buffer.clear();
                for (int idx = 0; idx < match; ++idx) {
                    this.buffer.put(boundary[idx]);
                }
                match = 0;
                if (body.read(this.buffer) == -1) {
                    break;
                }
                this.buffer.flip();
            }
            final ByteBuffer btarget = this.buffer.slice();
            final int offset = this.buffer.position();
            btarget.limit(0);
            while (this.buffer.hasRemaining()) {
                final byte data = this.buffer.get();
                if (data == boundary[match]) {
                    ++match;
                } else if (data == boundary[0]) {
                    match = 1;
                } else {
                    match = 0;
                    btarget.limit(this.buffer.position() - offset);
                }
                if (match == boundary.length) {
                    cont = false;
                    break;
                }
            }
            target.write(btarget);
        }
    }