Package io.helidon.common.reactive.valve
Class Valves
- java.lang.Object
-
- io.helidon.common.reactive.valve.Valves
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Valve<T>empty()Returns an emptyValve- instance, which report complete as soon as handler is registered.static <T> Valve<T>from(Flow.Publisher<T> publisher)Creates aValveinstance from providedFlow.Publisher.static Valve<ByteBuffer>from(InputStream stream, int bufferCapacity)static Valve<ByteBuffer>from(InputStream stream, int bufferCapacity, ExecutorService executorService)static <T> Valve<T>from(Iterable<T> iterable)static <T> Valve<T>from(T... t)Creates aValveinstance from provided array.
-
-
-
Method Detail
-
from
@SafeVarargs public static <T> Valve<T> from(T... t)
Creates aValveinstance from provided array.If
t arrayparameter isnullthen returns an emptyValve.- Type Parameters:
T- a type of the array items- Parameters:
t- an array to provide as aValve- Returns:
- the new instance
-
from
public static <T> Valve<T> from(Iterable<T> iterable)
Creates aValveinstance from the providedIterable.If
iterableparameter isnullthen returns an emptyValve.- Type Parameters:
T- a type of iterable items- Parameters:
iterable- an iterable to provide as aValve- Returns:
- the new instance
-
from
public static Valve<ByteBuffer> from(InputStream stream, int bufferCapacity)
Creates aByteBufferbasedValveinstance from the providedInputStream. Each byte buffer will have the provided capacity.Each byte buffer uses a newly allocated memory and as such no pooling is performed.
- Parameters:
stream- the input stream to create theValvefrombufferCapacity- the capacity of each buffer of bytes- Returns:
- the new instance
-
from
public static Valve<ByteBuffer> from(InputStream stream, int bufferCapacity, ExecutorService executorService)
Creates aByteBufferbasedValveinstance from the providedInputStream. Each byte buffer will have the provided capacity.Each byte buffer uses a newly allocated memory and as such no pooling is performed.
- Parameters:
stream- the input stream to create theValvefrombufferCapacity- the capacity of each buffer of bytesexecutorService- the executor service to use for an execution of theInputStream.read()(and its overloads) operations that are blocking by its nature.- Returns:
- the new instance
-
from
public static <T> Valve<T> from(Flow.Publisher<T> publisher)
Creates aValveinstance from providedFlow.Publisher.If
publisherparameter isnullthen returns an emptyValve.- Type Parameters:
T- a type of published items- Parameters:
publisher- a publisher to provide as aValve- Returns:
- the new instance
-
empty
public static <T> Valve<T> empty()
Returns an emptyValve- instance, which report complete as soon as handler is registered.For performance reason, this particular Valve accepts any amount of handlers.
- Type Parameters:
T- type of the item (which is not there :-) )- Returns:
- singleton instance
-
-