Copies the temp stream;
6879
public TempStream copy()
  {
    TempStream newStream = new TempStream();

    TempBuffer ptr = _head;

    for (; ptr != null; ptr = ptr.next()) {
      TempBuffer newPtr = TempBuffer.create();
      
      if (newStream._tail != null)
        newStream._tail.next(newPtr);
      else
        newStream._head = newPtr;
      newStream._tail = newPtr;

      newPtr.write(ptr.buffer(), 0, ptr.length());
    }

    return newStream;
  }
1109135
public void copyTo(int srcOffs, byte[] dst, int offs, int len) {
        arraycopy(bytes, srcOffs, dst, offs, len);
    }
670046
def stream_data(self, ostream):
        """"""
        istream = self.repo.odb.stream(self.binsha)
        stream_copy(istream, ostream)
        return self
563089
public static File copy(InputStream stream) throws IOException
  {
    File file = createTempFile();
    copy(stream, new FileOutputStream(file));
    return file;
  }
1237490
def tempput(local_path=None, remote_path=None, use_sudo=False,
            mirror_local_mode=False, mode=None):
    """"""
    import warnings
    warnings.simplefilter('ignore', RuntimeWarning)
    if remote_path is None:
        remote_path = os.tempnam()
    put(local_path, remote_path, use_sudo, mirror_local_mode, mode)
    yield remote_path
    run("rm '{}'".format(remote_path))
776227
public Datastream copy() {
        Datastream copy = new Datastream(id)
                .state(state)
                .controlGroup(controlGroup)
                .versionable(versionable);
        for (DatastreamVersion version: versions) {
            copy.versions().add(version.copy());
        }
        return copy;
    }
100208
function copyFile(source, dest) {

  fs.stat(dest, function (err, stats) {

    // If there was an error that is NOT that the file doesn't exist, then throw it.
    if (err && err.code !== 'ENOENT') {
      throw new Error(err);
    }

    // If the file exists then skip it.
    if (typeof stats === 'object') {
      process.stdout.write(`File exists: skipping (${dest})\n`);
    }

    return fs.createReadStream(source)
      .pipe(fs.createWriteStream(dest));

  });

}
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();
    }
636508
public Buffer copyTo(OutputStream out, long offset, long byteCount) throws IOException {
    if (out == null) throw new IllegalArgumentException("out == null");
    checkOffsetAndCount(size, offset, byteCount);
    if (byteCount == 0) return this;

    // Skip segments that we aren't copying from.
    Segment s = head;
    for (; offset >= (s.limit - s.pos); s = s.next) {
      offset -= (s.limit - s.pos);
    }

    // Copy from one segment at a time.
    for (; byteCount > 0; s = s.next) {
      int pos = (int) (s.pos + offset);
      int toCopy = (int) Math.min(s.limit - pos, byteCount);
      out.write(s.data, pos, toCopy);
      byteCount -= toCopy;
      offset = 0;
    }

    return this;
  }
570175
function (inputStream, outputStream, tempPath, tempPath2, err, callback) {
      async.parallel({
        unlink: function(cb) {
          if (!tempPath) {
            return callback(null);
          }
          removeLocalBlob(tempPath, cb);
        },

        unlink2: function(cb) {
          if (!tempPath2) {
            return callback(null);
          }
          removeLocalBlob(tempPath2, cb);
        },

        closeReadStream: function(cb) {
          inputStream.destroy();
          cb();
        },

        closeWriteStream: function(cb) {
          outputStream.destroy();
          cb();
        }
      }, cleanupError => {
        if (err) {
          return callback(err);
        }
        return callback(cleanupError);
      });
    }
703076
static public void copyStream(InputStream is, OutputStream os) throws IOException {
		copyStream(is, os, DEFAULT_TRANSFER_BUFFER_SIZE);
	}
310563
function copy (src, dest, dirname, done) {
      fsCompare.mtime(src, dest, function (err, diff) {
        if (err) return done(err)
        if (diff === 1) {
          if (fs.copyFile) fs.copyFile(src, dest, fin)
          else pump(fs.createReadStream(src), fs.createWriteStream(dest), fin)
        }
      })
      function fin (err) {
        if (err) return done(err)
        created(dirname, dest)
        done()
      }
    }
1334801
def ensure_tempfile(io, extension)
      tempfile = Tempfile.new(["down-net_http", extension], binmode: true)

      if io.is_a?(Tempfile)
        # Windows requires file descriptors to be closed before files are moved
        io.close
        tempfile.close
        FileUtils.mv io.path, tempfile.path
      else
        IO.copy_stream(io, tempfile)
        io.close
      end

      tempfile.open
      tempfile
    end
726263
public void writeToStream(OutputStream os)
    throws IOException
  {
    StreamImpl is = openReadImpl();
    TempBuffer tempBuffer = TempBuffer.create();
    try {
      byte []buffer = tempBuffer.buffer();
      int length = buffer.length;
      int len;

      while ((len = is.read(buffer, 0, length)) > 0) {
        os.write(buffer, 0, len);
      }
    } finally {
      TempBuffer.free(tempBuffer);
      tempBuffer = null;

      is.close();
    }
  }
651842
public static void copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int length) {
		System.arraycopy(src, srcOffset, dst, dstOffset, length);
	}
1225357
private void copy(InputStream is, OutputStream os) throws IOException {
		byte[] buffer = new byte[bufferSize];
		int nRead;
		while((nRead = is.read(buffer)) != -1) {
			os.write(buffer, 0, nRead);
		}
		os.flush();
	}
1060943
private void copyToStream(String txt, OutputStream stream) throws IOException {
        if (txt != null) {
            stream.write(txt.getBytes());
        }
    }