Class OperatorBufferWithTime<T>

  • Type Parameters:
    T - the buffered value type
    All Implemented Interfaces:
    Func1<Subscriber<? super List<T>>,Subscriber<? super T>>, Function, Observable.Operator<List<T>,T>


    public final class OperatorBufferWithTime<T>
    extends Object
    implements Observable.Operator<List<T>,T>
    This operation takes values from the specified Observable source and stores them in a buffer. Periodically the buffer is emitted and replaced with a new buffer. How often this is done depends on the specified timespan. The creation of chunks is also periodical. How often this is done depends on the specified timeshift. When the source Observable completes or produces an error, the current buffer is emitted, and the event is propagated to all subscribed Subscribers.

    Note that this operation can produce non-connected, or overlapping chunks depending on the input parameters.

    • Constructor Detail

      • OperatorBufferWithTime

        public OperatorBufferWithTime(long timespan,
                                      long timeshift,
                                      TimeUnit unit,
                                      int count,
                                      Scheduler scheduler)
        Parameters:
        timespan - the amount of time all chunks must be actively collect values before being emitted
        timeshift - the amount of time between creating chunks
        unit - the TimeUnit defining the unit of time for the timespan
        count - the maximum size of the buffer. Once a buffer reaches this size, it is emitted
        scheduler - the Scheduler to use for timing chunks