Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorBufferWithStartEndObservable<T, TOpening, 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
<TOpening>
the value type of the Observable opening buffers
<TClosing>
the value type of the Observable closing buffers
Imports
java.util.*, rx.Observable, .Observable.Operator, .Observer, .Subscriber, rx.exceptions.Exceptions, rx.functions.Func1, rx.observers.SerializedSubscriber, rx.subscriptions.CompositeSubscription

This operation takes values from the specified Observable source and stores them in the currently active chunks. Initially there are no chunks active.

Chunks can be created by pushing a TOpening value to the "bufferOpenings" Observable. This creates a new buffer which will then start recording values which are produced by the "source" Observable. Additionally the "bufferClosingSelector" will be used to construct an Observable which can produce values. When it does so it will close this (and only this) newly created buffer. When the source Observable completes or produces an error, all chunks are emitted, and the event is propagated to all subscribed Observers.

Note that when using this operation multiple overlapping chunks could be active at any one point.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Func1<? super TOpening, ? extends Observable<? extends TClosing>>
pack-priv final Observable<? extends TOpening>

Constructor Summary

AccessConstructor and Description
public
OperatorBufferWithStartEndObservable(Observable<? extends TOpening>
an Observable which when it produces a TOpening value will create a new buffer which instantly starts recording the "source" Observable
bufferOpenings
,
Func1<? super TOpening, ? extends Observable<? extends TClosing>>
a Func1 object which produces Observables. These Observables determine when a buffer is emitted and replaced by simply producing an object.
bufferClosingSelector
)

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

bufferClosingback to summary
pack-priv final Func1<? super TOpening, ? extends Observable<? extends TClosing>> bufferClosing
bufferOpeningback to summary
pack-priv final Observable<? extends TOpening> bufferOpening

Constructor Detail

OperatorBufferWithStartEndObservableback to summary
public OperatorBufferWithStartEndObservable(Observable<? extends TOpening> bufferOpenings, Func1<? super TOpening, ? extends Observable<? extends TClosing>> bufferClosingSelector)
Parameters
bufferOpenings:Observable<? extends TOpening>

an Observable which when it produces a TOpening value will create a new buffer which instantly starts recording the "source" Observable

bufferClosingSelector:Func1<? super TOpening, ? extends Observable<? extends TClosing>>

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

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 OperatorBufferWithStartEndObservable.BufferingSubscriber

extends Subscriber<T>
Class Inheritance

Field Summary

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

Guarded by this.

pack-priv final CompositeSubscription
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
endBuffer(List<T> toEnd)

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.
pack-priv void
startBuffer(TOpening v)

Inherited from rx.Subscriber:
addisUnsubscribedonStartrequestsetProducerunsubscribe

Field Detail

childback to summary
pack-priv final Subscriber<? super List<T>> child
chunksback to summary
pack-priv final List<List<T>> chunks

Guarded by this.

closingSubscriptionsback to summary
pack-priv final CompositeSubscription closingSubscriptions
doneback to summary
pack-priv boolean done

Guarded by this.

Constructor Detail

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

Method Detail

endBufferback to summary
pack-priv void endBuffer(List<T> toEnd)
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
startBufferback to summary
pack-priv void startBuffer(TOpening v)