All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nitorcreations.willow.deployer.StreamPumper Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.nitorcreations.willow.deployer;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

class StreamPumper implements Runnable {
	private final InputStream in;
	private final OutputStream out;

	public StreamPumper(InputStream in, OutputStream out) {
		this.out = out;
		this.in = in;
	}

	@Override
	public void run() {
		byte[] buffer = new byte[4 * 1024];
		try {
			int read;
			while ((read = in.read(buffer)) >= 0) {
				out.write(buffer, 0, read);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy