Class ClearableBufferProcessor<T>

  • Type Parameters:
    T - of the observable items to buffer.

    public class ClearableBufferProcessor<T>
    extends java.lang.Object
    Provides 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 the RunState, which is provided by another Flowable, is RunState.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 to RunState.RUNNING. If this Flowable is not provided or never emits any item, then the state is considered as being RunState.RUNNING all 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 buffer is customized by the following parameters, which can be set at any time. However, they are only effective at the moment when a new buffer is created (which happens anytime a new item is observed on the trigger Flowable).

    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 Detail

      • ClearableBufferProcessor

        public ClearableBufferProcessor()
    • 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)