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

com.github.thorbenkuck.network.stream.DataStream Maven / Gradle / Ivy

The newest version!
package com.github.thorbenkuck.network.stream;

public interface DataStream extends EventStream, Sink {

	static  DataStream wrap(DataStream eventStream) {
		if (!(eventStream instanceof ManagedEventStream)) {
			throw new IllegalArgumentException("A ManagedEventStream is required!");
		}
		return new DelegatingEventStream((ManagedEventStream) eventStream);
	}

	static  DataStream sequential() {
		return new SimpleEventStream<>();
	}

	static  DataStream strict() {
		return new StrictEventStream<>();
	}

	static  DataStream parallel() {
		return new ParallelEventStream<>();
	}

	static  DataStream of(Source source) {
		DataStream dataStream = sequential();
		source.onEmit(dataStream::push);
		return dataStream;
	}

	void push(T t);

	void pushError(Throwable throwable);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy