T
- the buffered value typepublic final class OperatorBufferWithTime<T> extends java.lang.Object implements Observable.Operator<java.util.List<T>,T>
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 Subscriber
s.
Note that this operation can produce non-connected, or overlapping chunks depending on the input parameters.
Constructor and Description |
---|
OperatorBufferWithTime(long timespan,
long timeshift,
java.util.concurrent.TimeUnit unit,
int count,
Scheduler scheduler) |
Modifier and Type | Method and Description |
---|---|
Subscriber<? super T> |
call(Subscriber<? super java.util.List<T>> child) |
public OperatorBufferWithTime(long timespan, long timeshift, java.util.concurrent.TimeUnit unit, int count, Scheduler scheduler)
timespan
- the amount of time all chunks must be actively collect values before being emittedtimeshift
- the amount of time between creating chunksunit
- the TimeUnit
defining the unit of time for the timespancount
- the maximum size of the buffer. Once a buffer reaches this size, it is emittedscheduler
- the Scheduler
to use for timing chunkspublic Subscriber<? super T> call(Subscriber<? super java.util.List<T>> child)
call
in interface Func1<Subscriber<? super java.util.List<T>>,Subscriber<? super T>>