Class RangePublisher

java.lang.Object
org.reactivestreams.example.unicast.RangePublisher
All Implemented Interfaces:
Publisher<Integer>

public final class RangePublisher extends Object implements Publisher<Integer>
A synchronous implementation of the Publisher that can be subscribed to multiple times and each individual subscription will receive range of monotonically increasing integer values on demand.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static final class 
    A Subscription implementation that holds the current downstream requested amount and responds to the downstream's request() and cancel() calls.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final int
    The number of items to emit.
    (package private) final int
    The starting value of the range.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RangePublisher(int start, int count)
    Constructs a RangePublisher instance with the given start and count values that yields a sequence of [start, start + count).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    subscribe(Subscriber<? super Integer> subscriber)
    Request Publisher to start streaming data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • start

      final int start
      The starting value of the range.
    • count

      final int count
      The number of items to emit.
  • Constructor Details

    • RangePublisher

      public RangePublisher(int start, int count)
      Constructs a RangePublisher instance with the given start and count values that yields a sequence of [start, start + count).
      Parameters:
      start - the starting value of the range
      count - the number of items to emit
  • Method Details