Packages

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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def &>[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, B]

    Operator alias for zipRight

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

    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]

    Concatenates with another stream in strict order

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

    Operator alias for zipLeft

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

    Operator alias for zip

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

    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)]

    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
    Definition Classes
    AnyRef → Any
  11. def aggregate[R1 <: R, E1 >: E, A1 >: A, C](sink: ZSink[R1, E1, A1, A1, C]): ZStream[R1, E1, C]

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

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

    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.

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

    Uses aggregateAsyncWithinEither but only returns the Right results.

    Uses aggregateAsyncWithinEither 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]

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

    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]]

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

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

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

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

  17. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  18. final def bimap[E1, A1](f: (E) ⇒ E1, g: (A) ⇒ A1)(implicit ev: CanFail[E]): ZStream[R, E1, A1]

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

  19. final def broadcast(n: Int, maximumLag: Int): ZManaged[R, Nothing, List[Stream[E, A]]]

    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.

  20. final def broadcastDynamic(maximumLag: Int): ZManaged[R, Nothing, UIO[Stream[E, A]]]

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

    Fan out the stream, producing a dynamic number 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.

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

    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.

    Queues can unsubscribe from upstream by shutting down.

  22. final def broadcastedQueuesDynamic[E1 >: E, A1 >: A](maximumLag: Int): ZManaged[R, Nothing, UIO[Queue[Take[E1, A1]]]]

    Converts the stream to a managed dynamic amount of queues.

    Converts the stream to a managed dynamic amount 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.

    Queues can unsubscribe from upstream by shutting down.

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

    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.

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

    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.

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

    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.

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

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

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

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

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

    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 causes of failure, including interruption of the stream is uninterruptible.

  29. def chunkN(chunkSize: Int): ZStreamChunk[R, E, A]

    Chunks the stream with specifed chunkSize

    Chunks the stream with specifed chunkSize

    chunkSize

    size of the chunk

  30. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  31. def collect[B](pf: PartialFunction[A, B]): ZStream[R, E, B]

    Performs a filter and map in a single step.

  32. final def collectM[R1 <: R, E1 >: E, B](pf: PartialFunction[A, ZIO[R1, E1, B]]): ZStream[R1, E1, B]
  33. def collectWhile[B](pf: PartialFunction[A, B]): ZStream[R, E, B]

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

  34. final def collectWhileM[R1 <: R, E1 >: E, B](pf: PartialFunction[A, ZIO[R1, E1, B]]): ZStream[R1, E1, B]
  35. 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]

    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.

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

    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.

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

    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.

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

    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.

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

    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.

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

    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. 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.

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

    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)
  42. final def drop(n: Int): ZStream[R, E, A]

    Drops the specified number of elements from this stream.

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

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

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

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

  45. final def either(implicit ev: CanFail[E]): ZStream[R, Nothing, Either[E, A]]

    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.

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

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

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

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

  48. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  49. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  50. def filter(pred: (A) ⇒ Boolean): ZStream[R, E, A]

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

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

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

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

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

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

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

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

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

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

    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.

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

    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.

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

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

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

    Executes an effectful fold over the stream of values.

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

    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.

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

    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.

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

    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
  63. 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]

    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

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

    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.

  65. 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]

    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

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

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

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

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

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

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

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

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

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

    Repeats this stream forever.

  71. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  72. final def groupBy[R1 <: R, E1 >: E, K, V](f: (A) ⇒ ZIO[R1, E1, (K, V)], buffer: Int = 16): GroupBy[R1, E1, K, V]

    More powerful version of ZStream.groupByKey

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

    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"))
  74. def grouped(chunkSize: Long): ZStream[R, E, List[A]]

    Partitions the stream with specifed chunkSize

    Partitions the stream with specifed chunkSize

    chunkSize

    size of the chunk

  75. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  76. final def interleave[R1 <: R, E1 >: E, A1 >: A](that: ZStream[R1, E1, A1]): ZStream[R1, E1, A1]

    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.

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

    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.

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

    Enqueues elements of this stream into a queue.

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

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

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

  80. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  81. def map[B](f0: (A) ⇒ B): ZStream[R, E, B]

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

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

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

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

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

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

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

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

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

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

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

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

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

  88. final def mapError[E1](f: (E) ⇒ E1)(implicit ev: CanFail[E]): ZStream[R, E1, A]

    Transforms the errors that possibly result from this stream.

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

    Transforms the errors that possibly result from this stream.

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

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

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

    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.

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

    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.

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

    Merges this stream and the specified stream together.

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

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

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

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

  96. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  97. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  98. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  99. final def orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZStream[R1, E2, A1])(implicit ev: CanFail[E]): ZStream[R1, E2, A1]

    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.

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

    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.

  101. 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])]

    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.

  102. 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])]

    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.

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

    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.

  104. final def provide(r: R)(implicit ev: NeedsEnv[R]): Stream[E, A]

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

  105. final def provideM[E1 >: E](r: ZIO[Any, E1, R])(implicit ev: NeedsEnv[R]): Stream[E1, A]

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

  106. final def provideManaged[E1 >: E](m: Managed[E1, R])(implicit ev: NeedsEnv[R]): Stream[E1, A]

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

  107. final def provideSome[R0](env: (R0) ⇒ R)(implicit ev: NeedsEnv[R]): ZStream[R0, E, A]

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

  108. final def provideSomeM[R0, E1 >: E](env: ZIO[R0, E1, R])(implicit ev: NeedsEnv[R]): ZStream[R0, E1, A]

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

  109. final def provideSomeManaged[R0, E1 >: E](env: ZManaged[R0, E1, R])(implicit ev: NeedsEnv[R]): ZStream[R0, E1, A]

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

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

    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.

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

    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.

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

    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.

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

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

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

    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]).

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

    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).

  116. def runHead: ZIO[R, E, Option[A]]

    Runs the stream returning the first element of the stream.

    Runs the stream returning the first element of the stream. Later elements will not be consumed / have effects run

  117. def runLast: ZIO[R, E, Option[A]]

    Runs the stream returning the last element and discarding all earlier elements.

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

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

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

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

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

    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".

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

    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".

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

    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.

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

    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.

  124. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  125. def take(n: Int): ZStream[R, E, A]

    Takes the specified number of elements from this stream.

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

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

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

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

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

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

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

    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.

  130. 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]

    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.

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

    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.

  132. 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]

    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.

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

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

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

    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" )
  135. final def toQueue[E1 >: E, A1 >: A](capacity: Int = 2): ZManaged[R, Nothing, Queue[Take[E1, A1]]]

    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.

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

    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.

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

    Alias for aggregate.

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

    Alias for aggregateManaged

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

    Filters any 'None'.

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

    Filters any 'Take'.

  142. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  143. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  144. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  145. final def zip[R1 <: R, E1 >: E, B](that: ZStream[R1, E1, B]): ZStream[R1, E1, (A, B)]

    Zips this stream together with the specified stream.

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

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

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

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

  148. 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]

    Zips two streams together with a specified function.

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

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

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

    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: Schedule[R1, A, A1]): ZStream[R1 with Clock, E, A1]
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use scheduleElements

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

    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