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

org.etlunit.io.BifurcatingOutputStream Maven / Gradle / Ivy

There is a newer version: 1.6.9
Show newest version
package org.etlunit.io;

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

public class BifurcatingOutputStream extends OutputStream
{
	private final OutputStream streama;
	private final OutputStream streamb;

	public BifurcatingOutputStream(OutputStream streamb, OutputStream streama)
	{
		this.streamb = streamb;
		this.streama = streama;
	}

	@Override
	public synchronized void write(int b) throws IOException
	{
		streama.write(b);
		streamb.write(b);
	}

	@Override
	public synchronized void write(byte[] b) throws IOException
	{
		streama.write(b);
		streamb.write(b);
	}

	@Override
	public synchronized void write(byte[] b, int off, int len) throws IOException
	{
		streama.write(b, off, len);
		streamb.write(b, off, len);
	}

	@Override
	public synchronized void flush() throws IOException
	{
		streama.flush();
		streamb.flush();
	}

	@Override
	public synchronized void close() throws IOException
	{
		streama.close();
		streamb.close();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy