Class FlowableEx

java.lang.Object
org.aksw.commons.rx.util.FlowableEx

public class FlowableEx extends Object
Additional factory methods for creating flowables, such as based on IO
Author:
raven
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T, R, E> io.reactivex.rxjava3.core.Flowable<T>
    fromEnumerableResource(org.aksw.commons.lambda.throwing.ThrowingSupplier<R> resourceSupplier, org.aksw.commons.lambda.throwing.ThrowingFunction<? super R,E> toEnumerable, org.aksw.commons.lambda.throwing.ThrowingFunction<? super E,T> nextRecord, org.aksw.commons.lambda.throwing.ThrowingBiConsumer<? super R,? super E> closer)
    static <T, R, C> io.reactivex.rxjava3.core.Flowable<T>
    fromIterableResource(org.aksw.commons.lambda.throwing.ThrowingSupplier<R> resourceSupplier, org.aksw.commons.lambda.throwing.ThrowingFunction<? super R,C> toIterable, org.aksw.commons.lambda.throwing.ThrowingFunction<? super C,? extends Iterator<T>> toIterator, org.aksw.commons.lambda.throwing.ThrowingBiConsumer<? super R,? super C> closer)
    Create a flowable from a supplier of resources with a subsequent processing into an iterator.
    static <T, I extends Iterator<T>>
    io.reactivex.rxjava3.core.Flowable<T>
    fromIteratorSupplier(org.aksw.commons.lambda.throwing.ThrowingSupplier<I> itSupp, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super I> closer)
    Create a flowable from a supplier of (closeable) iterator
    static <T, I extends Iterator<T>>
    io.reactivex.rxjava3.core.Flowable<T>
    fromIteratorSupplierLazyInit(org.aksw.commons.lambda.throwing.ThrowingSupplier<I> itSupp, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super I> closer)
    Variant that initializes the iterator as part of the generator such that any exception becomes available in the flow rather than on subscribe

    Methods inherited from class java.lang.Object

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

    • FlowableEx

      public FlowableEx()
  • Method Details

    • fromIteratorSupplier

      public static <T, I extends Iterator<T>> io.reactivex.rxjava3.core.Flowable<T> fromIteratorSupplier(org.aksw.commons.lambda.throwing.ThrowingSupplier<I> itSupp, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super I> closer)
      Create a flowable from a supplier of (closeable) iterator
    • fromIteratorSupplierLazyInit

      public static <T, I extends Iterator<T>> io.reactivex.rxjava3.core.Flowable<T> fromIteratorSupplierLazyInit(org.aksw.commons.lambda.throwing.ThrowingSupplier<I> itSupp, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super I> closer)
      Variant that initializes the iterator as part of the generator such that any exception becomes available in the flow rather than on subscribe
    • fromIterableResource

      public static <T, R, C> io.reactivex.rxjava3.core.Flowable<T> fromIterableResource(org.aksw.commons.lambda.throwing.ThrowingSupplier<R> resourceSupplier, org.aksw.commons.lambda.throwing.ThrowingFunction<? super R,C> toIterable, org.aksw.commons.lambda.throwing.ThrowingFunction<? super C,? extends Iterator<T>> toIterator, org.aksw.commons.lambda.throwing.ThrowingBiConsumer<? super R,? super C> closer)
      Create a flowable from a supplier of resources with a subsequent processing into an iterator. It is important to understand that resource acquisition happens during state initialization, whereas iterable initialization is done in the generator. This gives control over when exception handling: During state initialization there is no emitter and therefore exceptions cannot be passed downstream. Conversely, exceptions ocurring in the generator are always forwarded. Example use case: supply an input stream, create a commons CSV parser from it and then yield items from its iterator.
      Type Parameters:
      T - The item type
      R - The resource type
      C - The (conceptual) iterable derived from the resource (does not have to implement Iterable)
      I - The iterator derived from the iterable
      Parameters:
      resourceSupplier -
      toIterable -
      toIterator -
      closer -
      Returns:
    • fromEnumerableResource

      public static <T, R, E> io.reactivex.rxjava3.core.Flowable<T> fromEnumerableResource(org.aksw.commons.lambda.throwing.ThrowingSupplier<R> resourceSupplier, org.aksw.commons.lambda.throwing.ThrowingFunction<? super R,E> toEnumerable, org.aksw.commons.lambda.throwing.ThrowingFunction<? super E,T> nextRecord, org.aksw.commons.lambda.throwing.ThrowingBiConsumer<? super R,? super E> closer)
      Similar to fromIterableResource(ThrowingSupplier, ThrowingFunction, ThrowingFunction, ThrowingBiConsumer). Instead of an iterator there is just a 'nextRecord' method. Typicall a result of null indicates the end of data.
      Type Parameters:
      T -
      R -
      E -
      Parameters:
      resourceSupplier -
      toEnumerable -
      nextRecord -
      closer -
      Returns: