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 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 Subscriber
s.
Note that this operation can produce non-connected, or overlapping chunks depending on the input parameters.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final class
Subscriber when exact timed chunking is required.(package private) final class
Subscriber when the buffer chunking time and length differ. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOperatorBufferWithTime
(long timespan, long timeshift, TimeUnit unit, int count, Scheduler scheduler) -
Method Summary
-
Field Details
-
timespan
final long timespan -
timeshift
final long timeshift -
unit
-
count
final int count -
scheduler
-
-
Constructor Details
-
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 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 Details
-
call
- Specified by:
call
in interfaceFunc1<Subscriber<? super List<T>>,
Subscriber<? super T>>
-