public static long copyStreamToStream(InputStream in, OutputStream out, TaskMonitor monitor)
			throws IOException {

		long totalBytesCopied = 0;
		byte[] buffer = new byte[IO_BUFFER_SIZE];
		if (monitor != null) {
			out = new MonitoredOutputStream(out, monitor);
		}

		// Copy file contents
		int bytesRead = 0;
		while ((bytesRead = in.read(buffer)) >= 0) {
			out.write(buffer, 0, bytesRead);
			totalBytesCopied += bytesRead;
		}
		out.flush();
		return totalBytesCopied;
	}
Copy the <code>in</code> stream to the <code>out</code> stream.  The output stream will
<b>not</b> be closed when the copy operation is finished.

@param in source input stream
@param out the destination output stream
@param monitor if specified the progress will be reset and will advance to
				 100% when the copy is complete.
@return the number of bytes copied from the input stream to the output stream.
@throws IOException thrown if there was a problem accessing the files
Ghidra/Framework/Utility/src/main/java/utilities/util/FileUtilities.java