hu.akarnokd.rxjava2.operators

## Class FlowableTransformers

- java.lang.Object
- - hu.akarnokd.rxjava2.operators.FlowableTransformers

    public final class FlowableTransformers
    extends java.lang.Object

Additional operators in the form of `FlowableTransformer`, use `Flowable.compose(FlowableTransformer)` to apply the operators to an existing sequence.

Since:
  0.7.2

### Method Summary

All Methods Static Methods Concrete Methods
`static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>>` `bufferUntil(io.reactivex.functions.Predicate<? super T> predicate)` Buffers elements into a List until the given predicate returns true at which point a new empty buffer is started.
`static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C>` `bufferUntil(io.reactivex.functions.Predicate<? super T> predicate, java.util.concurrent.Callable<C> bufferSupplier)` Buffers elements into a custom collection until the given predicate returns true at which point a new empty custom collection is started.
`static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>>` `bufferWhile(io.reactivex.functions.Predicate<? super T> predicate)` Buffers elements into a List while the given predicate returns true; if the predicate returns false for an item, a new buffer is created with the specified item.
`static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C>` `bufferWhile(io.reactivex.functions.Predicate<? super T> predicate, java.util.concurrent.Callable<C> bufferSupplier)` Buffers elements into a custom collection while the given predicate returns true; if the predicate returns false for an item, a new collection is created with the specified item.
`static <T,R> io.reactivex.FlowableTransformer<T,R>` `mapFilter(io.reactivex.functions.BiConsumer<? super T,? super BasicEmitter<R>> consumer)` Allows mapping or filtering an upstream value through an emitter.
`static <T> io.reactivex.FlowableTransformer<T,T>` `onBackpressureTimeout(int maxSize, long timeout, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler, io.reactivex.functions.Consumer<? super T> onEvict)` Buffers the incoming values from upstream up to a maximum size or timeout if the downstream can't keep up.
`static <T> io.reactivex.FlowableTransformer<T,T>` `onBackpressureTimeout(long timeout, java.util.concurrent.TimeUnit unit)` Buffers the incoming values from upstream up to a maximum timeout if the downstream can't keep up.
`static <T> io.reactivex.FlowableTransformer<T,T>` `onBackpressureTimeout(long timeout, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler)` Buffers the incoming values from upstream up to a maximum timeout if the downstream can't keep up, running on a custom scheduler.
`static <T> io.reactivex.FlowableTransformer<T,T>` `onBackpressureTimeout(long timeout, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler, io.reactivex.functions.Consumer<? super T> onEvict)` Buffers the incoming values from upstream up to a maximum size or timeout if the downstream can't keep up.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long initialDelay, long betweenDelay, java.util.concurrent.TimeUnit unit)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long initialDelay, long betweenDelay, java.util.concurrent.TimeUnit unit, boolean delayError)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long initialDelay, long betweenDelay, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long initialDelay, long betweenDelay, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler, boolean delayError)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long betweenDelay, java.util.concurrent.TimeUnit unit)` Inserts a time delay between emissions from the upstream source.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long betweenDelay, java.util.concurrent.TimeUnit unit, boolean delayError)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long betweenDelay, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler)` Inserts a time delay between emissions from the upstream source.
`static <T> io.reactivex.FlowableTransformer<T,T>` `spanout(long betweenDelay, java.util.concurrent.TimeUnit unit, io.reactivex.Scheduler scheduler, boolean delayError)` Inserts a time delay between emissions from the upstream source, including an initial delay.
`static <T> io.reactivex.FlowableTransformer<T,T>` `valve(org.reactivestreams.Publisher<java.lang.Boolean> other)` Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source.
`static <T> io.reactivex.FlowableTransformer<T,T>` `valve(org.reactivestreams.Publisher<java.lang.Boolean> other, boolean defaultOpen)` Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source and starts with the specivied valve state.

`static <T> io.reactivex.FlowableTransformer<T,T>`

`valve(org.reactivestreams.Publisher<java.lang.Boolean> other, boolean defaultOpen, int bufferSize)`
Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source and starts with the specivied valve state and the specified buffer size hint.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### valve

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=PASS_THROUGH)
    public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other)

Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source.

Properties:

- The operator starts with an open valve.
- If the other Publisher completes, the sequence terminates with an `IllegalStateException`.
- The operator doesn't run on any particular `Scheduler`.
- The operator is a pass-through for backpressure and uses an internal unbounded buffer of size `Flowable.bufferSize()` to hold onto values if the valve is closed.

Type Parameters:
  `T` - the value type of the main source
Parameters:
  `other` - the other source
Returns:
  the new FlowableTransformer instance
Throws:
  `java.lang.NullPointerException` - if `other` is null
Since:
  0.7.2

#### valve

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=PASS_THROUGH)
    public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
                                                                                                                                              boolean defaultOpen)

Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source and starts with the specivied valve state.

Properties:

- If the other Publisher completes, the sequence terminates with an `IllegalStateException`.
- The operator doesn't run on any particular `Scheduler`.
- The operator is a pass-through for backpressure and uses an internal unbounded buffer of size `Flowable.bufferSize()` to hold onto values if the valve is closed.

Type Parameters:
  `T` - the value type of the main source
Parameters:
  `other` - the other source
  `defaultOpen` - should the valve start as open?
Returns:
  the new FlowableTransformer instance
Throws:
  `java.lang.NullPointerException` - if `other` is null
Since:
  0.7.2

#### valve

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=PASS_THROUGH)
    public static <T> io.reactivex.FlowableTransformer<T,T> valve(org.reactivestreams.Publisher<java.lang.Boolean> other,
                                                                                                                                              boolean defaultOpen,
                                                                                                                                              int bufferSize)

Relays values until the other Publisher signals false and resumes if the other Publisher signals true again, like closing and opening a valve and not losing any items from the main source and starts with the specivied valve state and the specified buffer size hint.

Properties:

- If the other Publisher completes, the sequence terminates with an `IllegalStateException`.
- The operator doesn't run on any particular `Scheduler`.

Type Parameters:
  `T` - the value type of the main source
Parameters:
  `other` - the other source
  `defaultOpen` - should the valve start as open?
  `bufferSize` - the buffer size hint (the chunk size of the underlying unbounded buffer)
Returns:
  the new FlowableTransformer instance
Throws:
  `java.lang.IllegalArgumentException` - if bufferSize <= 0
  `java.lang.NullPointerException` - if `other` is null
Since:
  0.7.2

#### bufferWhile

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=FULL)
    public static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> bufferWhile(io.reactivex.functions.Predicate<? super T> predicate)

Buffers elements into a List while the given predicate returns true; if the predicate returns false for an item, a new buffer is created with the specified item.

Type Parameters:
  `T` - the source value type
Parameters:
  `predicate` - the predicate receiving the current value and if returns false, a new buffer is created with the specified item
Returns:
  the new FlowableTransformer instance
Since:
  0.8.0

#### bufferWhile

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=FULL)
    public static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C> bufferWhile(io.reactivex.functions.Predicate<? super T> predicate,
                                                                                                                                                                                      java.util.concurrent.Callable<C> bufferSupplier)

Buffers elements into a custom collection while the given predicate returns true; if the predicate returns false for an item, a new collection is created with the specified item.

Type Parameters:
  `T` - the source value type
  `C` - the collection type
Parameters:
  `predicate` - the predicate receiving the current value and if returns false, a new collection is created with the specified item
  `bufferSupplier` - the callable that returns a fresh collection
Returns:
  the new FlowableTransformer instance
Since:
  0.8.0

#### bufferUntil

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=FULL)
    public static <T> io.reactivex.FlowableTransformer<T,java.util.List<T>> bufferUntil(io.reactivex.functions.Predicate<? super T> predicate)

Buffers elements into a List until the given predicate returns true at which point a new empty buffer is started.

Type Parameters:
  `T` - the source value type
Parameters:
  `predicate` - the predicate receiving the current itam and if returns true, the current buffer is emitted and a fresh empty buffer is created
Returns:
  the new FlowableTransformer instance
Since:
  0.8.0

#### bufferUntil

    @SchedulerSupport(value="none")
     @BackpressureSupport(value=FULL)
    public static <T,C extends java.util.Collection<? super T>> io.reactivex.FlowableTransformer<T,C> bufferUntil(io.reactivex.functions.Predicate<? super T> predicate,
                                                                                                                                                                                      java.util.concurrent.Callable<C> bufferSupplier)

Buffers elements into a custom collection until the given predicate returns true at which point a new empty custom collection is started.

Type Parameters:
  `T` - the source value type
  `C` - the collection type
Parameters:
  `predicate` - the predicate receiving the current itam and if returns true, the current collection is emitted and a fresh empty collection is created
  `bufferSupplier` - the callable that returns a fresh collection
Returns:
  the new Flowable instance
Since:
  0.8.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="io.reactivex:computation")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
                                                                                                                                                                    java.util.concurrent.TimeUnit unit)

Inserts a time delay between emissions from the upstream source.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses the computation `Scheduler`.

Type Parameters:
  `T` - the value type
Parameters:
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
                                                                                                                                                  java.util.concurrent.TimeUnit unit,
                                                                                                                                                  io.reactivex.Scheduler scheduler)

Inserts a time delay between emissions from the upstream source.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses a custom `Scheduler` you provide.

Type Parameters:
  `T` - the value type
Parameters:
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `scheduler` - the scheduler to delay and emit the values on
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="io.reactivex:computation")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
                                                                                                                                                                    long betweenDelay,
                                                                                                                                                                    java.util.concurrent.TimeUnit unit)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses the computation `Scheduler`.

Type Parameters:
  `T` - the value type
Parameters:
  `initialDelay` - the initial delay
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
                                                                                                                                                  long betweenDelay,
                                                                                                                                                  java.util.concurrent.TimeUnit unit,
                                                                                                                                                  io.reactivex.Scheduler scheduler)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses a custom `Scheduler` you provide.

Type Parameters:
  `T` - the value type
Parameters:
  `initialDelay` - the initial delay
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `scheduler` - the scheduler to delay and emit the values on
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="io.reactivex:computation")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
                                                                                                                                                                    java.util.concurrent.TimeUnit unit,
                                                                                                                                                                    boolean delayError)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses the computation `Scheduler`.

Type Parameters:
  `T` - the value type
Parameters:
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `delayError` - delay the onError event from upstream
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long betweenDelay,
                                                                                                                                                  java.util.concurrent.TimeUnit unit,
                                                                                                                                                  io.reactivex.Scheduler scheduler,
                                                                                                                                                  boolean delayError)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses a custom `Scheduler` you provide.

Type Parameters:
  `T` - the value type
Parameters:
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `scheduler` - the scheduler to delay and emit the values on
  `delayError` - delay the onError event from upstream
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="io.reactivex:computation")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
                                                                                                                                                                    long betweenDelay,
                                                                                                                                                                    java.util.concurrent.TimeUnit unit,
                                                                                                                                                                    boolean delayError)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses the computation `Scheduler`.

Type Parameters:
  `T` - the value type
Parameters:
  `initialDelay` - the initial delay
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `delayError` - delay the onError event from upstream
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### spanout

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> spanout(long initialDelay,
                                                                                                                                                  long betweenDelay,
                                                                                                                                                  java.util.concurrent.TimeUnit unit,
                                                                                                                                                  io.reactivex.Scheduler scheduler,
                                                                                                                                                  boolean delayError)

Inserts a time delay between emissions from the upstream source, including an initial delay.

Backpressure:
  The operator itself doesn't interfere with backpressure and uses an unbounded internal buffer to store elements that need delay.
Scheduler:
  The operator uses a custom `Scheduler` you provide.

Type Parameters:
  `T` - the value type
Parameters:
  `initialDelay` - the initial delay
  `betweenDelay` - the (minimum) delay time between elements
  `unit` - the time unit of the initial delay and the between delay values
  `scheduler` - the scheduler to delay and emit the values on
  `delayError` - delay the onError event from upstream
Returns:
  the new FlowableTransformer instance
Since:
  0.9.0

#### mapFilter

    @BackpressureSupport(value=PASS_THROUGH)
     @SchedulerSupport(value="none")
    public static <T,R> io.reactivex.FlowableTransformer<T,R> mapFilter(io.reactivex.functions.BiConsumer<? super T,? super BasicEmitter<R>> consumer)

Allows mapping or filtering an upstream value through an emitter.

Type Parameters:
  `T` - the input value type
  `R` - the output value type
Parameters:
  `consumer` - the consumer that is called for each upstream value and should call one of the doXXX methods on the BasicEmitter it receives (individual to each Subscriber).
Returns:
  the new FlowableTransformer instance
Since:
  0.10.0

#### onBackpressureTimeout

    @BackpressureSupport(value=UNBOUNDED_IN)
     @SchedulerSupport(value="io.reactivex:computation")
    public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
                                                                                                                                                                                  java.util.concurrent.TimeUnit unit)

Buffers the incoming values from upstream up to a maximum timeout if the downstream can't keep up.

Type Parameters:
  `T` - the value type
Parameters:
  `timeout` - the maximum age of an element in the buffer
  `unit` - the time unit of the timeout
Returns:
  the new FlowableTransformer instance
Since:
  0.13.0
See Also:
  `for more options`

#### onBackpressureTimeout

    @BackpressureSupport(value=UNBOUNDED_IN)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
                                                                                                                                                                java.util.concurrent.TimeUnit unit,
                                                                                                                                                                io.reactivex.Scheduler scheduler,
                                                                                                                                                                io.reactivex.functions.Consumer<? super T> onEvict)

Buffers the incoming values from upstream up to a maximum size or timeout if the downstream can't keep up.

Type Parameters:
  `T` - the value type
Parameters:
  `timeout` - the maximum age of an element in the buffer
  `unit` - the time unit of the timeout
  `scheduler` - the scheduler to be used as time source and to trigger the timeout & eviction
  `onEvict` - called when an element is evicted, maybe concurrently
Returns:
  the new FlowableTransformer instance
Since:
  0.13.0

#### onBackpressureTimeout

    @BackpressureSupport(value=UNBOUNDED_IN)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(long timeout,
                                                                                                                                                                java.util.concurrent.TimeUnit unit,
                                                                                                                                                                io.reactivex.Scheduler scheduler)

Buffers the incoming values from upstream up to a maximum timeout if the downstream can't keep up, running on a custom scheduler.

Type Parameters:
  `T` - the value type
Parameters:
  `timeout` - the maximum age of an element in the buffer
  `unit` - the time unit of the timeout
  `scheduler` - the scheduler to be used as time source and to trigger the timeout & eviction
Returns:
  the new FlowableTransformer instance
Since:
  0.13.0
See Also:
  `for more options`

#### onBackpressureTimeout

    @BackpressureSupport(value=UNBOUNDED_IN)
     @SchedulerSupport(value="custom")
    public static <T> io.reactivex.FlowableTransformer<T,T> onBackpressureTimeout(int maxSize,
                                                                                                                                                                long timeout,
                                                                                                                                                                java.util.concurrent.TimeUnit unit,
                                                                                                                                                                io.reactivex.Scheduler scheduler,
                                                                                                                                                                io.reactivex.functions.Consumer<? super T> onEvict)

Buffers the incoming values from upstream up to a maximum size or timeout if the downstream can't keep up.

Type Parameters:
  `T` - the value type
Parameters:
  `maxSize` - the maximum number of elements in the buffer, beyond that, the oldest element is evicted
  `timeout` - the maximum age of an element in the buffer
  `unit` - the time unit of the timeout
  `scheduler` - the scheduler to be used as time source and to trigger the timeout & eviction
  `onEvict` - called when an element is evicted, maybe concurrently
Returns:
  the new FlowableTransformer instance
Since:
  0.13.0