Observer that subscribes.
Example usage:
ReplaySubject<Object> subject = ReplaySubject.create();
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
subject.onCompleted();
// both of the following will get the onNext/onCompleted calls from above
subject.subscribe(observer1);
subject.subscribe(observer2);
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | ReplaySubject.ReplayBuffer<
the value type T>The base interface for buffering signals to be replayed to individual Subscribers. |
| pack-priv static class | ReplaySubject.ReplayProducer<
the value type T>A producer and subscription implementation that tracks the current replay position of a particular subscriber. |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | ReplaySubject.ReplayState<
the value type T>Holds onto the array of Subscriber-wrapping ReplayProducers and the buffer that holds values to be replayed; it manages subscription and signal dispatching. |
| pack-priv static class | ReplaySubject.ReplayUnboundedBuffer<
the value type T>An unbounded ReplayBuffer implementation that uses linked-arrays to avoid copy-on-grow situation with ArrayList. |
| Modifier and Type | Field and Description |
|---|---|
| private static final Object[] | EMPTY_ARRAY
An empty array to trigger getValues() to return a new array. |
| pack-priv final ReplaySubject. | state
The state storing the history and the references. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of items observed and emitted by the Subject T> ReplaySubject | |
| public static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectthe initial buffer capacity capacity)Creates an unbounded replay subject with the specified initial buffer capacity. |
| pack-priv static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectCreates an unbounded replay subject with the bounded-implementation for testing purposes. |
| pack-priv static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectCreates an unbounded replay subject with the time-bounded-implementation for testing purposes. |
| public static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectthe maximum number of buffered items size)Creates a size-bounded replay subject. |
| public static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectthe maximum age of the contained items time, TimeUnit the time unit of unit, final Scheduler timethe scheduler)Scheduler that provides the current timeCreates a time-bounded replay subject. |
| public static < the type of items observed and emitted by the Subject T> ReplaySubject | Returns: the created subjectthe maximum age of the contained items time, TimeUnit the time unit of unit, int timethe maximum number of buffered items size, final Scheduler the scheduler)Scheduler that provides the current timeCreates a time- and size-bounded replay subject. |
| public Throwable | Returns: the Throwable that terminated the Subject ornull if the
subject hasn't terminated yet or it terminated normally.Returns the Throwable that terminated the Subject. |
| public T | |
| public T[] | Returns: the arraya if it had enough capacity or a new array containing the available valuesthe array to fill in a)Returns a snapshot of the currently buffered non-terminal events into
the provided |
| public Object[] | Returns: a snapshot of the currently buffered non-terminal events.Returns a snapshot of the currently buffered non-terminal events. |
| public boolean | Returns: true if the Subject holds at least one non-terminal event available for replay
|
| public boolean | Returns: true if the subject completed normally viaonCompletedCheck if the Subject has terminated normally. |
| public boolean | hasObservers()
Implements abstract rx. Subject has Observers subscribed to it.
|
| public boolean | Returns: true if the subject has received a throwable throughonError.Check if the Subject has terminated with an exception. |
| public boolean | |
| public void | onCompleted()
Implements rx. Observable has finished sending push-based notifications.
|
| public void | onError(final Throwable
the exception encountered by the Observable e)Implements rx. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable t)Implements rx. |
| public int | Returns: the number of items availableReturns the current number of items (non-terminal events) available for replay. |
| pack-priv int |