Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorBufferWithSingleObservable<T, TClosing>

extends Object
implements Observable.Operator<List<T>, T>
Class Inheritance
All Implemented Interfaces
rx.Observable.Operator, rx.functions.Func1, rx.functions.Function
Type Parameters
<T>
the buffered value type
<TClosing>
the value type of the Observable signaling the end of each buffer
Imports
java.util.*, rx.Observable, .Observable.Operator, .Observer, .Subscriber, rx.exceptions.Exceptions, rx.functions.Func0, rx.observers.*

This operation takes values from the specified Observable source and stores them in a buffer until the Observable constructed using the Func0 argument, produces a value. The buffer is then emitted, and a new buffer is created to replace it. A new Observable will be constructed using the provided Func0 object, which will determine when this new buffer is emitted. When the source Observable completes or produces an error, the current buffer is emitted, and the event is propagated to all subscribed Observers.

Note that this operation only produces non-overlapping chunks. At all times there is exactly one buffer actively storing values.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Func0<? extends Observable<? extends TClosing>>
pack-priv final int

Constructor Summary

AccessConstructor and Description
public
OperatorBufferWithSingleObservable(Func0<? extends Observable<? extends TClosing>>
a Func0 object which produces Observables. These Observables determine when a buffer is emitted and replaced by simply producing an object.
bufferClosingSelector
,
int
the initial capacity of each buffer
initialCapacity
)

public
OperatorBufferWithSingleObservable(final Observable<? extends TClosing>
An Observable to determine when a buffer is emitted and replaced by simply producing an object.
bufferClosing
,
int
the initial capacity of each buffer
initialCapacity
)

Method Summary

Modifier and TypeMethod and Description
public Subscriber<? super T>
call(final Subscriber<? super List<T>> child)

Implements rx.functions.Func1.call.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferClosingSelectorback to summary
pack-priv final Func0<? extends Observable<? extends TClosing>> bufferClosingSelector
initialCapacityback to summary
pack-priv final int initialCapacity

Constructor Detail

OperatorBufferWithSingleObservableback to summary
public OperatorBufferWithSingleObservable(Func0<? extends Observable<? extends TClosing>> bufferClosingSelector, int initialCapacity)
Parameters
bufferClosingSelector:Func0<? extends Observable<? extends TClosing>>

a Func0 object which produces Observables. These Observables determine when a buffer is emitted and replaced by simply producing an object.

initialCapacity:int

the initial capacity of each buffer

OperatorBufferWithSingleObservableback to summary
public OperatorBufferWithSingleObservable(final Observable<? extends TClosing> bufferClosing, int initialCapacity)
Parameters
bufferClosing:Observable<? extends TClosing>

An Observable to determine when a buffer is emitted and replaced by simply producing an object.

initialCapacity:int

the initial capacity of each buffer

Method Detail

callback to summary
public Subscriber<? super T> call(final Subscriber<? super List<T>> child)

Implements rx.functions.Func1.call.

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorBufferWithSingleObservable.BufferingSubscriber

extends Subscriber<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super List<T>>
pack-priv List<T>
chunk

Guarded by this.

pack-priv boolean
done

Guarded by this.

Constructor Summary

AccessConstructor and Description
public
BufferingSubscriber(Subscriber<? super List<T>> child)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
emit()

public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(T
the item emitted by the Observable
t
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

childback to summary
pack-priv final Subscriber<? super List<T>> child
chunkback to summary
pack-priv List<T> chunk

Guarded by this.

doneback to summary
pack-priv boolean done

Guarded by this.

Constructor Detail

BufferingSubscriberback to summary
public BufferingSubscriber(Subscriber<? super List<T>> child)

Method Detail

emitback to summary
pack-priv void emit()
onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(T t)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
t:T

the item emitted by the Observable

Annotations
@Override