Class OperatorBufferWithTime<T>

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

    public final class OperatorBufferWithTime<T>
    extends java.lang.Object
    implements Observable.Operator<java.util.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.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int count  
      (package private) Scheduler scheduler  
      (package private) long timeshift  
      (package private) long timespan  
      (package private) java.util.concurrent.TimeUnit unit  
    • Constructor Summary

      Constructors 
      Constructor Description
      OperatorBufferWithTime​(long timespan, long timeshift, java.util.concurrent.TimeUnit unit, int count, Scheduler scheduler)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Subscriber<? super T> call​(Subscriber<? super java.util.List<T>> child)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • timespan

        final long timespan
      • timeshift

        final long timeshift
      • unit

        final java.util.concurrent.TimeUnit unit
      • count

        final int count
    • Constructor Detail

      • OperatorBufferWithTime

        public OperatorBufferWithTime​(long timespan,
                                      long timeshift,
                                      java.util.concurrent.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