src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @NonNull
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B> Flowable<Flowable<T>> window(Callable<? extends Publisher<B>> boundaryIndicatorSupplier, int bufferSize) {
        ObjectHelper.requireNonNull(boundaryIndicatorSupplier, "boundaryIndicatorSupplier is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new FlowableWindowBoundarySupplier<T, B>(this, boundaryIndicatorSupplier, bufferSize));
    }
@CheckReturnValue
    @NonNull
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B> Flowable<Flowable<T>> window(Callable<? extends Publisher<B>> boundaryIndicatorSupplier, int bufferSize) {
        ObjectHelper.requireNonNull(boundaryIndicatorSupplier, "boundaryIndicatorSupplier is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new FlowableWindowBoundarySupplier<T, B>(this, boundaryIndicatorSupplier, bufferSize));
    }
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Flowable < Flowable < T > > window ( Callable < ? extends Publisher < B > > boundaryIndicatorSupplier , int bufferSize ) { ObjectHelper . requireNonNull ( boundaryIndicatorSupplier , "boundaryIndicatorSupplier is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new FlowableWindowBoundarySupplier < T , B > ( this , boundaryIndicatorSupplier , bufferSize ) ) ; }
Returns a Flowable that emits windows of items it collects from the source Publisher. The resulting
Publisher emits connected, non-overlapping windows. It emits the current window and opens a new one
whenever the Publisher produced by the specified {@code closingSelector} emits an item.
<p>
<img width="640" height="455" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/window1.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator consumes the source {@code Publisher} in an unbounded manner.
The returned {@code Publisher} doesn't support backpressure as it uses
the {@code closingSelector} to control the creation of windows. The returned inner {@code Publisher}s honor
backpressure but have an unbounded inner buffer that <em>may</em> lead to {@code OutOfMemoryError}
if left unconsumed.</dd>
<dt><b>Scheduler:</b></dt>
<dd>This version of {@code window} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <B> the element type of the boundary Publisher
@param boundaryIndicatorSupplier
a {@link Callable} that returns a {@code Publisher} that governs the boundary between windows.
When the source {@code Publisher} emits an item, {@code window} emits the current window and begins
a new one.
@param bufferSize
the capacity hint for the buffer in the inner windows
@return a Flowable that emits connected, non-overlapping windows of items from the source Publisher
whenever {@code closingSelector} emits an item
@see <a href="http://reactivex.io/documentation/operators/window.html">ReactiveX operators documentation: Window</a>
Returns a Flowable that emits windows of items it collects from the source Publisher . The resulting Publisher emits connected non - overlapping windows . It emits the current window and opens a new one whenever the Publisher produced by the specified { @code closingSelector } emits an item . <p > <img width = 640 height = 455 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window1 . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > The operator consumes the source { @code Publisher } in an unbounded manner . The returned { @code Publisher } doesn t support backpressure as it uses the { @code closingSelector } to control the creation of windows . The returned inner { @code Publisher } s honor backpressure but have an unbounded inner buffer that <em > may< / em > lead to { @code OutOfMemoryError } if left unconsumed . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >