Top Description Inners Fields Constructors Methods
rx.internal.operators

public final Class OperatorBufferWithSize<T>

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
Imports
java.util.*, java.util.concurrent.atomic.*, rx.*, .Observable, .Observable.Operator, rx.exceptions.MissingBackpressureException

This operation takes values from the specified Observable source and stores them in all active chunks until the buffer contains a specified number of elements. The buffer is then emitted. Chunks are created after a certain amount of values have been received. When the source Observable completes or produces an error, the currently active chunks are emitted, and the event is propagated to all subscribed Subscribers.

Note that this operation can produce non-connected, connected non-overlapping, or overlapping chunks depending on the input parameters.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final int

Constructor Summary

AccessConstructor and Description
public
OperatorBufferWithSize(int
the number of elements a buffer should have before being emitted
count
,
int
the interval with which chunks have to be created. Note that when skip == count the operator will produce non-overlapping chunks. If skip < count, this buffer operation will produce overlapping chunks and if skip > count non-overlapping chunks will be created and some values will not be pushed into a buffer at all!
skip
)

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

countback to summary
pack-priv final int count
skipback to summary
pack-priv final int skip

Constructor Detail

OperatorBufferWithSizeback to summary
public OperatorBufferWithSize(int count, int skip)
Parameters
count:int

the number of elements a buffer should have before being emitted

skip:int

the interval with which chunks have to be created. Note that when skip == count the operator will produce non-overlapping chunks. If skip < count, this buffer operation will produce overlapping chunks and if skip > count non-overlapping chunks will be created and some values will not be pushed into a buffer at all!

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 OperatorBufferWithSize.BufferExact<T>

extends Subscriber<T>
Class Inheritance

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
BufferExact(Subscriber<? super List<T>> actual, int count)

Method Summary

Modifier and TypeMethod and Description
pack-priv Producer
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

actualback to summary
pack-priv final Subscriber<? super List<T>> actual
bufferback to summary
pack-priv List<T> buffer
countback to summary
pack-priv final int count

Constructor Detail

BufferExactback to summary
public BufferExact(Subscriber<? super List<T>> actual, int count)

Method Detail

createProducerback to summary
pack-priv Producer createProducer()
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
rx.internal.operators back to summary

pack-priv final Class OperatorBufferWithSize.BufferOverlap<T>

extends Subscriber<T>
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final Subscriber<? super List<T>>
pack-priv final int
pack-priv long
pack-priv long
pack-priv final ArrayDeque<List<T>>
pack-priv final AtomicLong
pack-priv final int

Constructor Summary

AccessConstructor and Description
public
BufferOverlap(Subscriber<? super List<T>> actual, int count, int skip)

Method Summary

Modifier and TypeMethod and Description
pack-priv Producer
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

actualback to summary
pack-priv final Subscriber<? super List<T>> actual
countback to summary
pack-priv final int count
indexback to summary
pack-priv long index
producedback to summary
pack-priv long produced
queueback to summary
pack-priv final ArrayDeque<List<T>> queue
requestedback to summary
pack-priv final AtomicLong requested

Hides rx.Subscriber.requested.

skipback to summary
pack-priv final int skip

Constructor Detail

BufferOverlapback to summary
public BufferOverlap(Subscriber<? super List<T>> actual, int count, int skip)

Method Detail

createProducerback to summary
pack-priv Producer createProducer()
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
rx.internal.operators back to summary

pack-priv final Class OperatorBufferWithSize.BufferOverlap.BufferOverlapProducer

extends AtomicBoolean
implements Producer
Class Inheritance
All Implemented Interfaces
rx.Producer

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
request(long
the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace
n
)

Implements rx.Producer.request.

Request a certain maximum number of items from this Producer.
Inherited from java.util.concurrent.atomic.AtomicBoolean:
compareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndSetgetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicBoolean.serialVersionUID.

Constructor Detail

BufferOverlapProducerback to summary
pack-priv BufferOverlapProducer()

Method Detail

requestback to summary
public void request(long n)

Implements rx.Producer.request.

Doc from rx.Producer.request.

Request a certain maximum number of items from this Producer. This is a way of requesting backpressure. To disable backpressure, pass Long.MAX_VALUE to this method.

Requests are additive but if a sequence of requests totals more than Long.MAX_VALUE then Long.MAX_VALUE requests will be actioned and the extras may be ignored. Arriving at Long.MAX_VALUE by addition of requests cannot be assumed to disable backpressure. For example, the code below may result in Long.MAX_VALUE requests being actioned only.

request(100);
request(Long.MAX_VALUE-1);
Parameters
n:long

the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace

Annotations
@Override
rx.internal.operators back to summary

pack-priv final Class OperatorBufferWithSize.BufferSkip<T>

extends Subscriber<T>
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
BufferSkip(Subscriber<? super List<T>> actual, int count, int skip)

Method Summary

Modifier and TypeMethod and Description
pack-priv Producer
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

actualback to summary
pack-priv final Subscriber<? super List<T>> actual
bufferback to summary
pack-priv List<T> buffer
countback to summary
pack-priv final int count
indexback to summary
pack-priv long index
skipback to summary
pack-priv final int skip

Constructor Detail

BufferSkipback to summary
public BufferSkip(Subscriber<? super List<T>> actual, int count, int skip)

Method Detail

createProducerback to summary
pack-priv Producer createProducer()
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
rx.internal.operators back to summary

pack-priv final Class OperatorBufferWithSize.BufferSkip.BufferSkipProducer

extends AtomicBoolean
implements Producer
Class Inheritance
All Implemented Interfaces
rx.Producer

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
request(long
the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace
n
)

Implements rx.Producer.request.

Request a certain maximum number of items from this Producer.
Inherited from java.util.concurrent.atomic.AtomicBoolean:
compareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndSetgetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleasetoStringweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.concurrent.atomic.AtomicBoolean.serialVersionUID.

Constructor Detail

BufferSkipProducerback to summary
pack-priv BufferSkipProducer()

Method Detail

requestback to summary
public void request(long n)

Implements rx.Producer.request.

Doc from rx.Producer.request.

Request a certain maximum number of items from this Producer. This is a way of requesting backpressure. To disable backpressure, pass Long.MAX_VALUE to this method.

Requests are additive but if a sequence of requests totals more than Long.MAX_VALUE then Long.MAX_VALUE requests will be actioned and the extras may be ignored. Arriving at Long.MAX_VALUE by addition of requests cannot be assumed to disable backpressure. For example, the code below may result in Long.MAX_VALUE requests being actioned only.

request(100);
request(Long.MAX_VALUE-1);
Parameters
n:long

the maximum number of items you want this Producer to produce, or Long.MAX_VALUE if you want the Producer to produce items at its own pace

Annotations
@Override