Class/Object

zio.stream

ZStream

Related Docs: object ZStream | package stream

Permalink

class ZStream[-R, +E, +A] extends Serializable

A Stream[E, A] represents an effectful stream that can produce values of type A, or potentially fail with a value of type E.

Streams have a very similar API to Scala collections, making them immediately familiar to most developers. Unlike Scala collections, streams can be used on effectful streams of data, such as HTTP connections, files, and so forth.

Streams do not leak resources. This guarantee holds in the presence of early termination (not all of a stream is consumed), failure, or even interruption.

Thanks to only first-order types, appropriate variance annotations, and specialized effect type (ZIO), streams feature extremely good type inference and should almost never require specification of any type parameters.

Self Type
ZStream[R, E, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZStream
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def &>[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Operator alias for zipRight

  4. final def *>[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Composes this stream with the specified stream to create a cartesian product of elements and keeps only the elements from the that stream.

    Composes this stream with the specified stream to create a cartesian product of elements and keeps only the elements from the that stream. The that stream would be run multiple times, for every element in the this stream.

    See also ZStream#zipWith and ZStream#<&> for the more common point-wise variant.

  5. final def ++[R1 <: R, E1 >: E, A1 >: A](other: ⇒ ZStream[R1, E1, A1]): ZStream[R1, E1, A1]

    Permalink

    Concatenates with another stream in strict order

  6. final def <&[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, A]

    Permalink

    Operator alias for zipLeft

  7. final def <&>[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, (A, B)]

    Permalink

    Operator alias for zip

  8. final def <*[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, A]

    Permalink

    Composes this stream with the specified stream to create a cartesian product of elements and keeps only the elements from the this stream.

    Composes this stream with the specified stream to create a cartesian product of elements and keeps only the elements from the this stream. The that stream would be run multiple times, for every element in the this stream.

    See also ZStream#zipWith and ZStream#<&> for the more common point-wise variant.

  9. final def <*>[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, (A, B)]

    Permalink

    Composes this stream with the specified stream to create a cartesian product of elements.

    Composes this stream with the specified stream to create a cartesian product of elements. The that stream would be run multiple times, for every element in the this stream.

    See also ZStream#zip and ZStream#<&> for the more common point-wise variant.

  10. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def aggregate[R1 <: R, E1 >: E, A1 >: A, B](sink: ZSink[R1, E1, A1, A1, B]): ZStream[R1, E1, B]

    Permalink

    Aggregates elements of this stream using the provided sink for as long as the downstream operators on the stream are busy.

    Aggregates elements of this stream using the provided sink for as long as the downstream operators on the stream are busy.

    This operator divides the stream into two asynchronous "islands". Operators upstream of this operator run on one fiber, while downstream operators run on another. Whenever the downstream fiber is busy processing elements, the upstream fiber will feed elements into the sink until it signals completion.

    Any sink can be used here, but see Sink.foldWeightedM and Sink.foldUntilM for sinks that cover the common usecases.

  12. final def aggregateWithin[R1 <: R, E1 >: E, A1 >: A, B, C](sink: ZSink[R1, E1, A1, A1, B], schedule: ZSchedule[R1, Option[B], C]): ZStream[R1 with Clock, E1, B]

    Permalink

    Uses aggregateWithinEither but only returns the Right results.

    Uses aggregateWithinEither but only returns the Right results.

    R1

    environment type

    E1

    error type

    A1

    type of the values consumed by the given sink

    B

    type of the value produced by the given sink and consumed by the given schedule

    C

    type of the value produced by the given schedule

    sink

    used for the aggregation

    schedule

    signalling for when to stop the aggregation

    returns

    ZStream[R1 with Clock, E1, B]

  13. final def aggregateWithinEither[R1 <: R, E1 >: E, A1 >: A, B, C](sink: ZSink[R1, E1, A1, A1, B], schedule: ZSchedule[R1, Option[B], C]): ZStream[R1 with Clock, E1, Either[C, B]]

    Permalink

    Aggregates elements using the provided sink until it signals completion, or the delay signalled by the schedule has passed.

    Aggregates elements using the provided sink until it signals completion, or the delay signalled by the schedule has passed.

    This operator divides the stream into two asynchronous islands. Operators upstream of this operator run on one fiber, while downstream operators run on another. Elements will be aggregated by the sink until the downstream fiber pulls the aggregated value, or until the schedule's delay has passed.

    Aggregated elements will be fed into the schedule to determine the delays between pulls.

    R1

    environment type

    E1

    error type

    A1

    type of the values consumed by the given sink

    B

    type of the value produced by the given sink and consumed by the given schedule

    C

    type of the value produced by the given schedule

    sink

    used for the aggregation

    schedule

    signalling for when to stop the aggregation

    returns

    ZStream[R1 with Clock, E1, Either[C, B]]

  14. final def as[B](b: ⇒ B): ZStream[R, E, B]

    Permalink

    Maps the success values of this stream to the specified constant value.

  15. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  16. final def bimap[E2, B](f: (E) ⇒ E2, g: (A) ⇒ B): ZStream[R, E2, B]

    Permalink

    Returns a stream whose failure and success channels have been mapped by the specified pair of functions, f and g.

  17. final def broadcast[E1 >: E, A1 >: A](n: Int, maximumLag: Int): ZManaged[R, Nothing, List[ZStream[Any, E, A]]]

    Permalink

    Fan out the stream, producing a list of streams that have the same elements as this stream.

    Fan out the stream, producing a list of streams that have the same elements as this stream. The driver streamer will only ever advance of the maximumLag values before the slowest downstream stream.

  18. final def broadcastedQueues[E1 >: E, A1 >: A](n: Int, maximumLag: Int): ZManaged[R, Nothing, List[Queue[Take[E1, A1]]]]

    Permalink

    Converts the stream to a managed list of queues.

    Converts the stream to a managed list of queues. Every value will be replicated to every queue with the slowest queue being allowed to buffer maximumLag elements before the driver is backpressured. The downstream queues will be provided with elements in the same order they are returned, so the fastest queue might have seen up to (maximumLag + 1) elements more than the slowest queue if it has a lower index than the slowest queue. During the finalizer the driver will wait for all queues to shutdown in order to signal completion. After the managed value is used, the queues will never again produce values and should be discarded.

  19. final def buffer(capacity: Int): ZStream[R, E, A]

    Permalink

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a queue.

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a queue.

    Note

    Prefer capacities that are powers of 2 for better performance.

  20. final def bufferDropping(capacity: Int): ZStream[R, E, A]

    Permalink

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a dropping queue.

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a dropping queue.

    Note

    Prefer capacities that are powers of 2 for better performance.

  21. final def bufferSliding(capacity: Int): ZStream[R, E, A]

    Permalink

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a sliding queue.

    Allows a faster producer to progress independently of a slower consumer by buffering up to capacity elements in a sliding queue.

    Note

    Prefer capacities that are powers of 2 for better performance.

  22. final def bufferUnbounded: ZStream[R, E, A]

    Permalink

    Allows a faster producer to progress independently of a slower consumer by buffering elements into an unbounded queue.

  23. final def catchAll[R1 <: R, E2, A1 >: A](f: (E) ⇒ ZStream[R1, E2, A1]): ZStream[R1, E2, A1]

    Permalink

    Switches over to the stream produced by the provided function in case this one fails with a typed error.

  24. final def catchAllCause[R1 <: R, E2, A1 >: A](f: (Cause[E]) ⇒ ZStream[R1, E2, A1]): ZStream[R1, E2, A1]

    Permalink

    Switches over to the stream produced by the provided function in case this one fails.

    Switches over to the stream produced by the provided function in case this one fails. Allows recovery from all errors, except external interruption.

  25. def chunkN(chunkSize: Int): ZStream[R, E, Chunk[A]]

    Permalink

    Chunks the stream with specifed chunkSize

    Chunks the stream with specifed chunkSize

    chunkSize

    size of the chunk

  26. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def collect[B](pf: PartialFunction[A, B]): ZStream[R, E, B]

    Permalink

    Performs a filter and map in a single step.

  28. def collectWhile[B](pred: PartialFunction[A, B]): ZStream[R, E, B]

    Permalink

    Transforms all elements of the stream for as long as the specified partial function is defined.

  29. final def combine[R1 <: R, E1 >: E, A1 >: A, S1, B, C](that: ZStream[R1, E1, B])(s1: S1)(f0: (S1, Pull[R, E, A], Pull[R1, E1, B]) ⇒ ZIO[R1, E1, (S1, Take[E1, C])]): ZStream[R1, E1, C]

    Permalink

    Combines this stream and the specified stream by repeatedly applying the function f0 to extract an element from the queues and conceptually "offer" it to the destination stream.

    Combines this stream and the specified stream by repeatedly applying the function f0 to extract an element from the queues and conceptually "offer" it to the destination stream. f0 can maintain some internal state to control the combining process, with the initial state being specified by s1.

  30. final def concat[R1 <: R, E1 >: E, A1 >: A](other: ⇒ ZStream[R1, E1, A1]): ZStream[R1, E1, A1]

    Permalink

    Appends another stream to this stream.

    Appends another stream to this stream. The concatenated stream will first emit the elements of this stream, and then emit the elements of the other stream.

  31. final def cross[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, (A, B)]

    Permalink

    Composes this stream with the specified stream to create a cartesian product of elements.

    Composes this stream with the specified stream to create a cartesian product of elements. The that stream would be run multiple times, for every element in the this stream.

    See also ZStream#zip and ZStream#<&> for the more common point-wise variant.

  32. final def crossWith[R1 <: R, E1 >: E, B, C](that: ZStream[R1, E1, B])(f: (A, B) ⇒ C): ZStream[R1, E1, C]

    Permalink

    Composes this stream with the specified stream to create a cartesian product of elements with a specified function.

    Composes this stream with the specified stream to create a cartesian product of elements with a specified function. The that stream would be run multiple times, for every element in the this stream.

    See also ZStream#zip and ZStream#<&> for the more common point-wise variant.

  33. final def distributedDynamicWith[E1 >: E, A1 >: A](maximumLag: Int, decide: (A) ⇒ UIO[(Int) ⇒ Boolean], done: (Take[E1, Nothing]) ⇒ UIO[Any] = (_: Any) => UIO.unit): ZManaged[R, Nothing, UIO[(Int, Queue[Take[E1, A1]])]]

    Permalink

    More powerful version of ZStream#distributedWith.

    More powerful version of ZStream#distributedWith. This returns a function that will produce new queues and corresponding indices. You can also provide a function that will be executed after the final events are enqueued in all queues but before the queues are actually shutdown. Shutdown of the queues is handled by the driver. Downstream users can also shutdown queues manually. In this case the driver will continue but no longer backpressure on them.

  34. final def distributedWith[E1 >: E, A1 >: A](n: Int, maximumLag: Int, decide: (A) ⇒ UIO[(Int) ⇒ Boolean]): ZManaged[R, Nothing, List[Queue[Take[E1, A1]]]]

    Permalink

    More powerful version of ZStream#broadcast.

    More powerful version of ZStream#broadcast. Allows to provide a function that determines what queues should receive which elements.

  35. final def drain: ZStream[R, E, Nothing]

    Permalink

    Converts this stream to a stream that executes its effects but emits no elements.

    Converts this stream to a stream that executes its effects but emits no elements. Useful for sequencing effects using streams:

    (Stream(1, 2, 3).tap(i => ZIO(println(i))) ++
      Stream.lift(ZIO(println("Done!"))).drain ++
      Stream(4, 5, 6).tap(i => ZIO(println(i)))).run(Sink.drain)
  36. final def drop(n: Int): ZStream[R, E, A]

    Permalink

    Drops the specified number of elements from this stream.

  37. final def dropUntil(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Drops all elements of the stream until the specified predicate evaluates to true.

  38. def dropWhile(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Drops all elements of the stream for as long as the specified predicate evaluates to true.

  39. final def either: ZStream[R, Nothing, Either[E, A]]

    Permalink

    Returns a stream whose failures and successes have been lifted into an Either.

    Returns a stream whose failures and successes have been lifted into an Either. The resulting stream cannot fail, because the failures have been exposed as part of the Either success case.

    Note

    the stream will end as soon as the first error occurs.

  40. final def ensuring[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStream[R1, E, A]

    Permalink

    Executes the provided finalizer after this stream's finalizers run.

  41. final def ensuringFirst[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStream[R1, E, A]

    Permalink

    Executes the provided finalizer before this stream's finalizers run.

  42. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  43. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  44. def filter(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Filters this stream by the specified predicate, retaining all elements for which the predicate evaluates to true.

  45. final def filterM[R1 <: R, E1 >: E](pred: (A) ⇒ ZIO[R1, E1, Boolean]): ZStream[R1, E1, A]

    Permalink

    Filters this stream by the specified effectful predicate, retaining all elements for which the predicate evaluates to true.

  46. final def filterNot(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.

  47. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  48. final def fixed[R1 <: R, E1 >: E, A1 >: A](duration: Duration): ZStream[R1 with Clock, E1, A1]

    Permalink

    Emits elements of this stream with a fixed delay in between, regardless of how long it takes to produce a value.

  49. final def flatMap[R1 <: R, E1 >: E, B](f0: (A) ⇒ ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Returns a stream made of the concatenation in strict order of all the streams produced by passing each element of this stream to f0

  50. final def flatMapPar[R1 <: R, E1 >: E, B](n: Int, outputBuffer: Int = 16)(f: (A) ⇒ ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently.

    Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently. Up to outputBuffer elements of the produced streams may be buffered in memory by this operator.

  51. final def flatMapParSwitch[R1 <: R, E1 >: E, B](n: Int, bufferSize: Int = 16)(f: (A) ⇒ ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently.

    Maps each element of this stream to another stream and returns the non-deterministic merge of those streams, executing up to n inner streams concurrently. When a new stream is created from an element of the source stream, the oldest executing stream is cancelled. Up to bufferSize elements of the produced streams may be buffered in memory by this operator.

  52. final def fold[A1 >: A, S](s: S)(f: (S, A1) ⇒ S): ZIO[R, E, S]

    Permalink

    Executes a pure fold over the stream of values - reduces all elements in the stream to a value of type S.

  53. final def foldM[R1 <: R, E1 >: E, A1 >: A, S](s: S)(f: (S, A1) ⇒ ZIO[R1, E1, S]): ZIO[R1, E1, S]

    Permalink

    Executes an effectful fold over the stream of values.

  54. final def foldManaged[A1 >: A, S](s: S)(f: (S, A1) ⇒ S): ZManaged[R, E, S]

    Permalink

    Executes a pure fold over the stream of values.

    Executes a pure fold over the stream of values. Returns a Managed value that represents the scope of the stream.

  55. final def foldManagedM[R1 <: R, E1 >: E, A1 >: A, S](s: S)(f: (S, A1) ⇒ ZIO[R1, E1, S]): ZManaged[R1, E1, S]

    Permalink

    Executes an effectful fold over the stream of values.

    Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream.

  56. final def foldWhile[A1 >: A, S](s: S)(cont: (S) ⇒ Boolean)(f: (S, A1) ⇒ S): ZIO[R, E, S]

    Permalink

    Reduces the elements in the stream to a value of type S.

    Reduces the elements in the stream to a value of type S. Stops the fold early when the condition is not fulfilled. Example:

    Stream(1).forever.foldWhile(0)(_ <= 4)(_ + _) // UIO[Int] == 5
  57. final def foldWhileM[R1 <: R, E1 >: E, A1 >: A, S](s: S)(cont: (S) ⇒ Boolean)(f: (S, A1) ⇒ ZIO[R1, E1, S]): ZIO[R1, E1, S]

    Permalink

    Executes an effectful fold over the stream of values.

    Executes an effectful fold over the stream of values. Stops the fold early when the condition is not fulfilled. Example:

    Stream(1)
      .forever                                // an infinite Stream of 1's
      .fold(0)(_ <= 4)((s, a) => UIO(s + a))  // UIO[Int] == 5
    cont

    function which defines the early termination condition

  58. def foldWhileManaged[A1 >: A, S](s: S)(cont: (S) ⇒ Boolean)(f: (S, A1) ⇒ S): ZManaged[R, E, S]

    Permalink

    Executes a pure fold over the stream of values.

    Executes a pure fold over the stream of values. Returns a Managed value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled.

  59. final def foldWhileManagedM[R1 <: R, E1 >: E, A1 >: A, S](s: S)(cont: (S) ⇒ Boolean)(f: (S, A1) ⇒ ZIO[R1, E1, S]): ZManaged[R1, E1, S]

    Permalink

    Executes an effectful fold over the stream of values.

    Executes an effectful fold over the stream of values. Returns a Managed value that represents the scope of the stream. Stops the fold early when the condition is not fulfilled. Example:

    Stream(1)
      .forever                                // an infinite Stream of 1's
      .fold(0)(_ <= 4)((s, a) => UIO(s + a))  // Managed[Nothing, Int]
      .use(ZIO.succeed)                       // UIO[Int] == 5
    cont

    function which defines the early termination condition

  60. final def foreach[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Any]): ZIO[R1, E1, Unit]

    Permalink

    Consumes all elements of the stream, passing them to the specified callback.

  61. final def foreachManaged[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Any]): ZManaged[R1, E1, Unit]

    Permalink

    Like ZStream#foreach, but returns a ZManaged so the finalization order can be controlled.

  62. final def foreachWhile[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Boolean]): ZIO[R1, E1, Unit]

    Permalink

    Consumes elements of the stream, passing them to the specified callback, and terminating consumption when the callback returns false.

  63. final def foreachWhileManaged[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Boolean]): ZManaged[R1, E1, Unit]

    Permalink

    Like ZStream#foreachWhile, but returns a ZManaged so the finalization order can be controlled.

  64. final def forever: ZStream[R, E, A]

    Permalink

    Repeats this stream forever.

  65. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  66. final def groupBy[R1 <: R, E1 >: E, K, V](f: (A) ⇒ ZIO[R1, E1, (K, V)], buffer: Int = 16): GroupBy[R1, E1, K, V]

    Permalink

    More powerful version of ZStream.groupByKey

  67. final def groupByKey[K](f: (A) ⇒ K, buffer: Int = 16): GroupBy[R, E, K, A]

    Permalink

    Partition a stream using a function and process each stream individually.

    Partition a stream using a function and process each stream individually. This returns a data structure that can be used to further filter down which groups shall be processed.

    After apply on the GroupBy object, the remaining groups will be processed in parallel and the resulting streams merged in a nondeterministic fashion.

    Up to buffer elements may be buffered in a group stream until the producer is backpressured. Take care to consume from all streams in order to prevent deadlocks.

    Example: Collect the first 2 words for every starting letter from a stream of words.

    ZStream.fromIterable(List("hello", "world", "hi", "holla"))
     .groupByKey(_.head) { case (k, s) => s.take(2).map((k, _)) }
     .runCollect
     .map(_ == List(('h', "hello"), ('h', "hi"), ('w', "world"))
  68. def grouped(chunkSize: Long): ZStream[R, E, List[A]]

    Permalink

    Partitions the stream with specifed chunkSize

    Partitions the stream with specifed chunkSize

    chunkSize

    size of the chunk

  69. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  70. final def interleave[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]

    Permalink

    Interleaves this stream and the specified stream deterministically by alternating pulling values from this stream and the specified stream.

    Interleaves this stream and the specified stream deterministically by alternating pulling values from this stream and the specified stream. When one stream is exhausted all remaining values in the other stream will be pulled.

  71. final def interleaveWith[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1])(b: ZStream[R1, E1, Boolean]): ZStream[R1, E1, A1]

    Permalink

    Combines this stream and the specified stream deterministically using the stream of boolean values b to control which stream to pull from next.

    Combines this stream and the specified stream deterministically using the stream of boolean values b to control which stream to pull from next. true indicates to pull from this stream and false indicates to pull from the specified stream. Only consumes as many elements as requested by b. If either this stream or the specified stream are exhausted further requests for values from that stream will be ignored.

  72. final def into[R1 <: R, E1 >: E, A1 >: A](queue: ZQueue[R1, E1, Nothing, Any, Take[E1, A1], Any]): ZIO[R1, E1, Unit]

    Permalink

    Enqueues elements of this stream into a queue.

    Enqueues elements of this stream into a queue. Stream failure and ending will also be signalled.

  73. final def intoManaged[R1 <: R, E1 >: E, A1 >: A](queue: ZQueue[R1, E1, Nothing, Any, Take[E1, A1], Any]): ZManaged[R1, E1, Unit]

    Permalink

    Like ZStream#into, but provides the result as a ZManaged to allow for scope composition.

  74. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  75. def map[B](f0: (A) ⇒ B): ZStream[R, E, B]

    Permalink

    Returns a stream made of the elements of this stream transformed with f0

  76. def mapAccum[S1, B](s1: S1)(f1: (S1, A) ⇒ (S1, B)): ZStream[R, E, B]

    Permalink

    Statefully maps over the elements of this stream to produce new elements.

  77. final def mapAccumM[R1 <: R, E1 >: E, S1, B](s1: S1)(f1: (S1, A) ⇒ ZIO[R1, E1, (S1, B)]): ZStream[R1, E1, B]

    Permalink

    Statefully and effectfully maps over the elements of this stream to produce new elements.

  78. final def mapConcat[B](f: (A) ⇒ Iterable[B]): ZStream[R, E, B]

    Permalink

    Maps each element to an iterable, and flattens the iterables into the output of this stream.

  79. def mapConcatChunk[B](f: (A) ⇒ Chunk[B]): ZStream[R, E, B]

    Permalink

    Maps each element to a chunk, and flattens the chunks into the output of this stream.

  80. final def mapConcatChunkM[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, Chunk[B]]): ZStream[R1, E1, B]

    Permalink

    Effectfully maps each element to a chunk, and flattens the chunks into the output of this stream.

  81. final def mapConcatM[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, Iterable[B]]): ZStream[R1, E1, B]

    Permalink

    Effectfully maps each element to an iterable, and flattens the iterables into the output of this stream.

  82. final def mapError[E1](f: (E) ⇒ E1): ZStream[R, E1, A]

    Permalink

    Transforms the errors that possibly result from this stream.

  83. final def mapErrorCause[E1](f: (Cause[E]) ⇒ Cause[E1]): ZStream[R, E1, A]

    Permalink

    Transforms the errors that possibly result from this stream.

  84. final def mapM[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Maps over elements of the stream with the specified effectful function.

  85. final def mapMPar[R1 <: R, E1 >: E, B](n: Int)(f: (A) ⇒ ZIO[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently.

    Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. Transformed elements will be emitted in the original order.

  86. final def mapMParUnordered[R1 <: R, E1 >: E, B](n: Int)(f: (A) ⇒ ZIO[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently.

    Maps over elements of the stream with the specified effectful function, executing up to n invocations of f concurrently. The element order is not enforced by this combinator, and elements may be reordered.

  87. final def merge[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]

    Permalink

    Merges this stream and the specified stream together.

  88. final def mergeEither[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, Either[A, B]]

    Permalink

    Merges this stream and the specified stream together to produce a stream of eithers.

  89. final def mergeWith[R1 <: R, E1 >: E, B, C](that: ZStream[R1, E1, B])(l: (A) ⇒ C, r: (B) ⇒ C): ZStream[R1, E1, C]

    Permalink

    Merges this stream and the specified stream together to a common element type with the specified mapping functions.

  90. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  91. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  92. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  93. final def orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZStream[R1, E2, A1]): ZStream[R1, E2, A1]

    Permalink

    Switches to the provided stream in case this one fails with a typed error.

    Switches to the provided stream in case this one fails with a typed error.

    See also ZStream#catchAll.

  94. def partition(p: (A) ⇒ Boolean, buffer: Int = 16): ZManaged[R, E, (ZStream[R, E, A], ZStream[Any, E, A])]

    Permalink

    Partition a stream using a predicate.

    Partition a stream using a predicate. The first stream will contain all element evaluated to true and the second one will contain all element evaluated to false. The faster stream may advance by up to buffer elements further than the slower one.

  95. final def partitionEither[B, C, R1 <: R, E1 >: E](p: (A) ⇒ ZIO[R1, E1, Either[B, C]], buffer: Int = 16): ZManaged[R1, E1, (ZStream[Any, E1, B], ZStream[Any, E1, C])]

    Permalink

    Split a stream by a predicate.

    Split a stream by a predicate. The faster stream may advance by up to buffer elements further than the slower one.

  96. final def peel[R1 <: R, E1 >: E, A1 >: A, B](sink: ZSink[R1, E1, A1, A1, B]): ZManaged[R1, E1, (B, ZStream[R1, E1, A1])]

    Permalink

    Peels off enough material from the stream to construct an R using the provided ZSink and then returns both the R and the remainder of the ZStream in a managed resource.

    Peels off enough material from the stream to construct an R using the provided ZSink and then returns both the R and the remainder of the ZStream in a managed resource. Like all ZManaged values, the provided remainder is valid only within the scope of ZManaged.

  97. val process: ZManaged[R, E, Pull[R, E, A]]

    Permalink

    process is a low-level consumption method, usually used for creating combinators and constructors.

    process is a low-level consumption method, usually used for creating combinators and constructors. For most usage, ZStream#fold, ZStream#foreach or ZStream#run should be preferred.

    The contract for the returned Pull is as follows: - It must not be evaluted concurrently from multiple fibers - it is (usually) not thread-safe; - If an evaluation of the Pull is interrupted, it is not safe to evaluate it again - it is (usually) not interruption-safe; - Once the Pull has failed with a None, it is not safe to evaluate it again.

    The managed Pull can be used to read from the stream until it is empty (or possibly forever, if the stream is infinite). The provided Pull is valid only inside the scope of the managed resource.

  98. final def provide(r: R): Stream[E, A]

    Permalink

    Provides the stream with its required environment, which eliminates its dependency on R.

  99. final def provideM[E1 >: E](r: ZIO[Any, E1, R]): Stream[E1, A]

    Permalink

    An effectual version of provide, useful when the act of provision requires an effect.

  100. final def provideManaged[E1 >: E](m: Managed[E1, R]): Stream[E1, A]

    Permalink

    Uses the given Managed to provide the environment required to run this stream, leaving no outstanding environments.

  101. final def provideSome[R0](env: (R0) ⇒ R): ZStream[R0, E, A]

    Permalink

    Provides some of the environment required to run this effect, leaving the remainder R0.

  102. final def provideSomeM[R0, E1 >: E](env: ZIO[R0, E1, R]): ZStream[R0, E1, A]

    Permalink

    Provides some of the environment required to run this effect, leaving the remainder R0.

  103. final def provideSomeManaged[R0, E1 >: E](env: ZManaged[R0, E1, R]): ZStream[R0, E1, A]

    Permalink

    Uses the given ZManaged to provide some of the environment required to run this stream, leaving the remainder R0.

  104. final def repeat[R1 <: R, B, C](schedule: ZSchedule[R1, Unit, B]): ZStream[R1, E, A]

    Permalink

    Repeats the entire stream using the specified schedule.

    Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule.

  105. final def repeatEither[R1 <: R, B](schedule: ZSchedule[R1, Unit, B]): ZStream[R1, E, Either[B, A]]

    Permalink

    Repeats the entire stream using the specified schedule.

    Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule. The schedule output will be emitted at the end of each repetition.

  106. final def repeatWith[R1 <: R, B, C](schedule: ZSchedule[R1, Unit, B])(f: (A) ⇒ C, g: (B) ⇒ C): ZStream[R1, E, C]

    Permalink

    Repeats the entire stream using the specified schedule.

    Repeats the entire stream using the specified schedule. The stream will execute normally, and then repeat again according to the provided schedule. The schedule output will be emitted at the end of each repetition and can be unified with the stream elements using the provided functions.

  107. def run[R1 <: R, E1 >: E, A0, A1 >: A, B](sink: ZSink[R1, E1, A0, A1, B]): ZIO[R1, E1, B]

    Permalink

    Runs the sink on the stream to produce either the sink's result or an error.

  108. final def runCollect: ZIO[R, E, List[A]]

    Permalink

    Runs the stream and collects all of its elements in a list.

    Runs the stream and collects all of its elements in a list.

    Equivalent to run(Sink.collectAll[A]).

  109. final def runDrain: ZIO[R, E, Unit]

    Permalink

    Runs the stream purely for its effects.

    Runs the stream purely for its effects. Any elements emitted by the stream are discarded.

    Equivalent to run(Sink.drain).

  110. final def schedule[R1 <: R, A1 >: A](schedule: ZSchedule[R1, A, Any]): ZStream[R1 with Clock, E, A1]

    Permalink

    Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite).

  111. final def scheduleEither[R1 <: R, E1 >: E, B](schedule: ZSchedule[R1, A, B]): ZStream[R1 with Clock, E1, Either[B, A]]

    Permalink

    Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite).

  112. final def scheduleElements[R1 <: R, A1 >: A](schedule: ZSchedule[R1, A, Any]): ZStream[R1 with Clock, E, A1]

    Permalink

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed.

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed. Repeats are done in addition to the first execution, so that scheduleElements(Schedule.once) means "emit element and if not short circuited, repeat element once".

  113. final def scheduleElementsEither[R1 <: R, E1 >: E, B](schedule: ZSchedule[R1, A, B]): ZStream[R1 with Clock, E1, Either[B, A]]

    Permalink

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed.

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed. Repeats are done in addition to the first execution, so that scheduleElements(Schedule.once) means "emit element and if not short circuited, repeat element once".

  114. final def scheduleElementsWith[R1 <: R, E1 >: E, B, C](schedule: ZSchedule[R1, A, B])(f: (A) ⇒ C, g: (B) ⇒ C): ZStream[R1 with Clock, E1, C]

    Permalink

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed.

    Repeats each element of the stream using the provided schedule, additionally emitting the schedule's output each time a schedule is completed. Repeats are done in addition to the first execution, so that scheduleElements(Schedule.once) means "emit element and if not short circuited, repeat element once". Uses the provided functions to align the stream and schedule outputs on a common type.

  115. final def scheduleWith[R1 <: R, E1 >: E, B, C](schedule: ZSchedule[R1, A, B])(f: (A) ⇒ C, g: (B) ⇒ C): ZStream[R1, E1, C]

    Permalink

    Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite).

    Schedules the output of the stream using the provided schedule and emits its output at the end (if schedule is finite). Uses the provided function to align the stream and schedule outputs on the same type.

  116. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  117. def take(n: Int): ZStream[R, E, A]

    Permalink

    Takes the specified number of elements from this stream.

  118. def takeUntil(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Takes all elements of the stream until the specified predicate evaluates to true.

  119. def takeWhile(pred: (A) ⇒ Boolean): ZStream[R, E, A]

    Permalink

    Takes all elements of the stream for as long as the specified predicate evaluates to true.

  120. final def tap[R1 <: R, E1 >: E](f: (A) ⇒ ZIO[R1, E1, Any]): ZStream[R1, E1, A]

    Permalink

    Adds an effect to consumption of every element of the stream.

  121. final def throttleEnforce(units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ Long): ZStream[R with Clock, E, A]

    Permalink

    Throttles elements of type A according to the given bandwidth parameters using the token bucket algorithm.

    Throttles elements of type A according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a units + burst threshold. Elements that do not meet the bandwidth constraints are dropped. The weight of each element is determined by the costFn function.

  122. final def throttleEnforceM[R1 <: R, E1 >: E](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ ZIO[R1, E1, Long]): ZStream[R1 with Clock, E1, A]

    Permalink

    Throttles elements of type A according to the given bandwidth parameters using the token bucket algorithm.

    Throttles elements of type A according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a units + burst threshold. Elements that do not meet the bandwidth constraints are dropped. The weight of each element is determined by the costFn effectful function.

  123. final def throttleShape(units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ Long): ZStream[R with Clock, E, A]

    Permalink

    Delays elements of type A according to the given bandwidth parameters using the token bucket algorithm.

    Delays elements of type A according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a units + burst threshold. The weight of each element is determined by the costFn function.

  124. final def throttleShapeM[R1 <: R, E1 >: E](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ ZIO[R1, E1, Long]): ZStream[R1 with Clock, E1, A]

    Permalink

    Delays elements of type A according to the given bandwidth parameters using the token bucket algorithm.

    Delays elements of type A according to the given bandwidth parameters using the token bucket algorithm. Allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a units + burst threshold. The weight of each element is determined by the costFn effectful function.

  125. final def timeout(d: Duration): ZStream[R with Clock, E, A]

    Permalink

    Interrupts the stream if it does not produce a value after d duration.

  126. def toInputStream(implicit ev0: <:<[E, Throwable], ev1: <:<[A, Byte]): ZManaged[R, E, InputStream]

    Permalink

    Converts this stream of bytes into a java.io.InputStream wrapped in a ZManaged.

    Converts this stream of bytes into a java.io.InputStream wrapped in a ZManaged. The returned input stream will only be valid within the scope of the ZManaged.

    Annotations
    @silent( "never used" )
  127. final def toQueue[E1 >: E, A1 >: A](capacity: Int = 2): ZManaged[R, Nothing, Queue[Take[E1, A1]]]

    Permalink

    Converts the stream to a managed queue.

    Converts the stream to a managed queue. After the managed queue is used, the queue will never again produce values and should be discarded.

  128. final def toQueueUnbounded[E1 >: E, A1 >: A]: ZManaged[R, Nothing, Queue[Take[E1, A1]]]

    Permalink

    Converts the stream into an unbounded managed queue.

    Converts the stream into an unbounded managed queue. After the managed queue is used, the queue will never again produce values and should be discarded.

  129. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  130. def transduce[R1 <: R, E1 >: E, A1 >: A, C](sink: ZSink[R1, E1, A1, A1, C]): ZStream[R1, E1, C]

    Permalink

    Applies a transducer to the stream, which converts one or more elements of type A into elements of type C.

  131. final def transduceManaged[R1 <: R, E1 >: E, A1 >: A, B](managedSink: ZManaged[R1, E1, ZSink[R1, E1, A1, A1, B]]): ZStream[R1, E1, B]

    Permalink

    Applies a transducer to the stream, converting elements of type A into elements of type C, with a managed resource of type D available.

  132. final def unNone[A1](implicit ev: <:<[A, Option[A1]]): ZStream[R, E, A1]

    Permalink

    Filters any 'None'.

  133. final def unTake[E1 >: E, A1](implicit ev: <:<[A, Take[E1, A1]]): ZStream[R, E1, A1]

    Permalink

    Filters any 'Take'.

  134. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  135. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  136. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  137. final def zip[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, (A, B)]

    Permalink

    Zips this stream together with the specified stream.

  138. final def zipLeft[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, A]

    Permalink

    Runs this stream with the specified stream parallelly and keeps only values of this stream.

  139. final def zipRight[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Permalink

    Runs this stream with the specified stream parallelly and keeps only values of specified stream.

  140. final def zipWith[R1 <: R, E1 >: E, B, C](that: ZStream[R1, E1, B])(f0: (Option[A], Option[B]) ⇒ Option[C]): ZStream[R1, E1, C]

    Permalink

    Zips two streams together with a specified function.

  141. final def zipWithIndex: ZStream[R, E, (A, Int)]

    Permalink

    Zips this stream together with the index of elements of the stream.

  142. final def zipWithLatest[R1 <: R, E1 >: E, B, C](that: ZStream[R1, E1, B])(f0: (A, B) ⇒ C): ZStream[R1, E1, C]

    Permalink

    Zips the two streams so that when a value is emitted by either of the two streams, it is combined with the latest value from the other stream to produce a result.

Deprecated Value Members

  1. final def spaced[R1 <: R, A1 >: A](schedule: ZSchedule[R1, A, A1]): ZStream[R1 with Clock, E, A1]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use scheduleElements

  2. final def spacedEither[R1 <: R, B](schedule: ZSchedule[R1, A, B]): ZStream[R1 with Clock, E, Either[B, A]]

    Permalink

    Analogical to spaced but with distinction of stream elements and schedule output represented by Either

    Analogical to spaced but with distinction of stream elements and schedule output represented by Either

    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use scheduleElementsEither

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped