public static long streamCopy(InputStream is, OutputStream os, TaskMonitor monitor)
			throws IOException, CancelledException {
		byte buffer[] = new byte[FileUtilities.IO_BUFFER_SIZE];
		int bytesRead;
		long totalBytesCopied = 0;
		while ((bytesRead = is.read(buffer)) > 0) {
			os.write(buffer, 0, bytesRead);
			totalBytesCopied += bytesRead;
			monitor.setProgress(totalBytesCopied);
			monitor.checkCancelled();
		}
		os.flush();
		return totalBytesCopied;
	}
Copy a stream while updating a TaskMonitor.

@param is {@link InputStream} source of bytes 
@param os {@link OutputStream} destination of bytes
@param monitor {@link TaskMonitor} to update
@return number of bytes copied
@throws IOException if error
@throws CancelledException if cancelled
Ghidra/Features/Base/src/main/java/ghidra/formats/gfilesystem/FSUtilities.java