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

net.fortytwo.flow.Tee Maven / Gradle / Ivy

There is a newer version: 1.5
Show newest version
package net.fortytwo.flow;

import net.fortytwo.ripple.RippleException;

/**
 * A "tee" pipeline which passes data to both of two downstream sinks.
 * @param  the type of data being passed
 *
 * @author Joshua Shinavier (http://fortytwo.net)
 */
public class Tee implements Sink
{
	private final Sink left, right;

    /**
     * Constructs a new tee using the given sinks
     * @param left one of the two downstream sinks
     * @param right the other of the two downstream sinks
     */
	public Tee( final Sink left, final Sink right)
	{
		this.left = left;
		this.right = right;
	}

    /**
     * Receives the next data item
     * @param t the data item being passed
     * @throws RippleException if a data handling error occurs
     */
	public void put( final  T t ) throws RippleException
	{
		left.put(t);
		right.put(t);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy