Package rx.internal.operators
Class OperatorBufferWithTime<T>
- java.lang.Object
-
- rx.internal.operators.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 specifiedObservable
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 sourceObservable
completes or produces an error, the current buffer is emitted, and the event is propagated to all subscribedSubscriber
s.Note that this operation can produce non-connected, or overlapping chunks depending on the input parameters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
OperatorBufferWithTime.ExactSubscriber
Subscriber when exact timed chunking is required.(package private) class
OperatorBufferWithTime.InexactSubscriber
Subscriber when the buffer chunking time and length differ.
-
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)
-
-
-
Field Detail
-
timespan
final long timespan
-
timeshift
final long timeshift
-
unit
final java.util.concurrent.TimeUnit unit
-
count
final int count
-
scheduler
final Scheduler scheduler
-
-
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 emittedtimeshift
- the amount of time between creating chunksunit
- theTimeUnit
defining the unit of time for the timespancount
- the maximum size of the buffer. Once a buffer reaches this size, it is emittedscheduler
- theScheduler
to use for timing chunks
-
-
Method Detail
-
call
public Subscriber<? super T> call(Subscriber<? super java.util.List<T>> child)
- Specified by:
call
in interfaceFunc1<Subscriber<? super java.util.List<T>>,Subscriber<? super T>>
-
-