com.github.thorbenkuck.network.stream.Source Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easy-net Show documentation
Show all versions of easy-net Show documentation
An EventStream driven, simple to use Client/Server framework
The newest version!
package com.github.thorbenkuck.network.stream;
import java.util.function.Consumer;
public interface Source {
static Source create() {
return new DistributingSource<>();
}
default void onEmit(Consumer consumer) {
onEmit(new SourceConsumer<>() {
@Override
public void onCancel() {}
@Override
public void accept(T t) {
consumer.accept(t);
}
});
}
void push(T t);
void onEmit(SourceConsumer consumer);
void close();
}