Class ClearableBufferProcessor<T>
- java.lang.Object
-
- org.streamingpool.core.rx.process.ClearableBufferProcessor<T>
-
- Type Parameters:
T- of the observable items to buffer.
public class ClearableBufferProcessor<T> extends java.lang.ObjectProvides a buffered version of an observable of items of a certain type, where the buffering can be customized. Additionally, the input is only propagated if theRunState, which is provided by another Flowable, isRunState.RUNNING.The following input Flowable can/must be provided:
- An input Flowable (
setInput(Flowable)): This Flowable provides the elements which have to be buffered. This Flowable has to be provided (else the resulting Flowable will simply never publish anything). - A Flowable of a runstate (
setRunState(Flowable)): The items of the input Flowable are only propagated when the run state is equal toRunState.RUNNING. If this Flowable is not provided or never emits any item, then the state is considered as beingRunState.RUNNINGall the time. - A trigger Flowable (
setClearTrigger(Flowable)): Each time a new item is received on this Flowable, a new (empty) buffer is created, which then fills up.
The possible options are:
setBufferSize(int): The size of the buffers.setMinEmitSize(int): This is the first index at which the first buffer starts emitting. This buffer then fills up and is emitted when it is full. All following buffers are only emitted once. The default value for this is 1.
-
-
Constructor Summary
Constructors Constructor Description ClearableBufferProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.reactivex.Flowable<java.util.List<T>>bufferedContent()voidsetBufferSize(int bufferSize)voidsetBufferSize(io.reactivex.Flowable<java.lang.Integer> bufferSize)voidsetClearTrigger(io.reactivex.Flowable<?> triggerClear)voidsetInput(io.reactivex.Flowable<T> input)voidsetMinEmitSize(int minEmitSize)voidsetRunState(io.reactivex.Flowable<RunState> runState)voidsetRunState(RunState runState)
-
-
-
Method Detail
-
setClearTrigger
public void setClearTrigger(io.reactivex.Flowable<?> triggerClear)
-
bufferedContent
public io.reactivex.Flowable<java.util.List<T>> bufferedContent()
-
setMinEmitSize
public void setMinEmitSize(int minEmitSize)
-
setBufferSize
public void setBufferSize(int bufferSize)
-
setBufferSize
public void setBufferSize(io.reactivex.Flowable<java.lang.Integer> bufferSize)
-
setInput
public void setInput(io.reactivex.Flowable<T> input)
-
setRunState
public void setRunState(RunState runState)
-
setRunState
public void setRunState(io.reactivex.Flowable<RunState> runState)
-
-