class ZStreamChunk[-R, +E, +A] extends Serializable
A ZStreamChunk[R, E, A] represents an effectful stream that can produce values of
type A, or potentially fail with a value of type E.
ZStreamChunk differs from ZStream in that elements in the stream are processed
in batches, which is orders of magnitude more efficient than dealing with each
element individually.
ZStreamChunk is particularly suited for situations where you are dealing with values
of primitive types, e.g. those coming off a java.io.InputStream
- Self Type
- ZStreamChunk[R, E, A]
- Alphabetic
- By Inheritance
- ZStreamChunk
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ++[R1 <: R, E1 >: E, A1 >: A](that: ZStreamChunk[R1, E1, A1]): ZStreamChunk[R1, E1, A1]
Concatenates with another stream in strict order
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def buffer(capacity: Int): ZStreamChunk[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a queue.Allows a faster producer to progress independently of a slower consumer by buffering up to
capacitychunks in a queue.- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferDropping(capacity: Int): ZStreamChunk[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering elements into a dropping queue.
Allows a faster producer to progress independently of a slower consumer by buffering elements into a dropping queue.
- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferSliding(capacity: Int): ZStreamChunk[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering elements into a sliding queue.
Allows a faster producer to progress independently of a slower consumer by buffering elements into a sliding queue.
- Note
Prefer capacities that are powers of 2 for better performance.
- final def bufferUnbounded: ZStreamChunk[R, E, A]
Allows a faster producer to progress independently of a slower consumer by buffering elements into an unbounded queue.
- final def catchAll[R1 <: R, E2, A1 >: A](f: (E) => ZStreamChunk[R1, E2, A1])(implicit ev: CanFail[E]): ZStreamChunk[R1, E2, A1]
Switches over to the stream produced by the provided function in case this one fails with a typed error.
- final def catchAllCause[R1 <: R, E2, A1 >: A](f: (Cause[E]) => ZStreamChunk[R1, E2, A1]): ZStreamChunk[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 errors, except external interruption.
- final def chunkN(chunkSize: Int): ZStreamChunk[R, E, A]
Chunks the stream with specified chunkSize
Chunks the stream with specified chunkSize
- chunkSize
size of the chunk
- val chunks: ZStream[R, E, Chunk[A]]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def collect[B](p: PartialFunction[A, B]): ZStreamChunk[R, E, B]
Collects a filtered, mapped subset of the stream.
- def collectWhile[B](p: PartialFunction[A, B]): ZStreamChunk[R, E, B]
Transforms all elements of the stream for as long as the specified partial function is defined.
- def drop(n: Int): ZStreamChunk[R, E, A]
Drops the specified number of elements from this stream.
- final def dropUntil(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Drops all elements of the stream until the specified predicate evaluates to
true. - def dropWhile(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Drops all elements of the stream for as long as the specified predicate evaluates to
true. - final def either(implicit ev: CanFail[E]): ZStreamChunk[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 theEithersuccess case.- Note
the stream will end as soon as the first error occurs.
- final def ensuring[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStreamChunk[R1, E, A]
Executes the provided finalizer after this stream's finalizers run.
- final def ensuringFirst[R1 <: R](fin: ZIO[R1, Nothing, Any]): ZStreamChunk[R1, E, A]
Executes the provided finalizer before this stream's finalizers run.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Filters this stream by the specified predicate, retaining all elements for which the predicate evaluates to true.
- final def filterM[R1 <: R, E1 >: E](pred: (A) => ZIO[R1, E1, Boolean]): ZStreamChunk[R1, E1, A]
Filters this stream by the specified effectful predicate, retaining all elements for which the predicate evaluates to true.
- final def filterNot(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Filters this stream by the specified predicate, removing all elements for which the predicate evaluates to true.
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def flatMap[R1 <: R, E1 >: E, B](f0: (A) => ZStreamChunk[R1, E1, B]): ZStreamChunk[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 - def flattenChunks: ZStream[R, E, A]
Returns a stream made of the concatenation of all the chunks in this stream
- 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.Executes a pure fold over the stream of values - reduces all elements in the stream to a value of type
S. See ZStream.fold - 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.
Executes an effectful fold over the stream of values. See ZStream.foldM
- 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. See ZStream.foldManaged
- 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. See ZStream.foldManagedM
- 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. See ZStream.foldWhile - 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. See ZStream.foldWhileM
- 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. Stops the fold early when the condition is not fulfilled. See ZStream.foldWhileManaged
- 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. Stops the fold early when the condition is not fulfilled. See ZStream.foldWhileManagedM
- final def foreach[R1 <: R, E1 >: E](f: (A) => ZIO[R1, E1, Unit]): ZIO[R1, E1, Unit]
Consumes all elements of the stream, passing them to the specified callback.
- 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. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) => B): ZStreamChunk[R, E, B]
Returns a stream made of the elements of this stream transformed with
f0 - final def mapAccum[S1, B](s1: S1)(f1: (S1, A) => (S1, B)): ZStreamChunk[R, E, B]
Statefully maps over the elements of this stream to produce new elements.
- final def mapAccumM[R1 <: R, E1 >: E, S1, B](s1: S1)(f1: (S1, A) => ZIO[R1, E1, (S1, B)]): ZStreamChunk[R1, E1, B]
Statefully and effectfully maps over the elements of this stream to produce new elements.
- final def mapConcat[B](f: (A) => Iterable[B]): ZStreamChunk[R, E, B]
Maps each element to an iterable and flattens the iterables into the output of this stream.
- def mapConcatChunk[B](f: (A) => Chunk[B]): ZStreamChunk[R, E, B]
Maps each element to a chunk and flattens the chunks into the output of this stream.
- final def mapConcatChunkM[R1 <: R, E1 >: E, B](f: (A) => ZIO[R1, E1, Chunk[B]]): ZStreamChunk[R1, E1, B]
Effectfully maps each element to a chunk and flattens the chunks into the output of this stream.
- final def mapConcatM[R1 <: R, E1 >: E, B](f: (A) => ZIO[R1, E1, Iterable[B]]): ZStreamChunk[R1, E1, B]
Effectfully maps each element to an iterable and flattens the iterables into the output of this stream.
- final def mapError[E1](f: (E) => E1)(implicit ev: CanFail[E]): ZStreamChunk[R, E1, A]
Transforms the errors that possibly result from this stream.
- final def mapErrorCause[E1](f: (Cause[E]) => Cause[E1]): ZStreamChunk[R, E1, A]
Transforms the errors that possibly result from this stream.
- final def mapM[R1 <: R, E1 >: E, B](f0: (A) => ZIO[R1, E1, B]): ZStreamChunk[R1, E1, B]
Maps over elements of the stream with the specified effectful function.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def orElse[R1 <: R, E2, A1 >: A](that: => ZStreamChunk[R1, E2, A1])(implicit ev: CanFail[E]): ZStreamChunk[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.
- final def process: ZManaged[R, Nothing, Pull[R, E, A]]
- final def provide(r: R)(implicit ev: NeedsEnv[R]): StreamChunk[E, A]
Provides the stream with its required environment, which eliminates its dependency on
R. - final def provideSome[R0](env: (R0) => R)(implicit ev: NeedsEnv[R]): ZStreamChunk[R0, E, A]
Provides some of the environment required to run this effect, leaving the remainder
R0. - final def run[R1 <: R, E1 >: E, A0, A1 >: A, B](sink: ZSink[R1, E1, A0, Chunk[A1], B]): ZIO[R1, E1, B]
Runs the sink on the stream to produce either the sink's result or an error.
- 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]). - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def take(n: Int): ZStreamChunk[R, E, A]
Takes the specified number of elements from this stream.
- def takeUntil(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Takes all elements of the stream until the specified predicate evaluates to
true. - def takeWhile(pred: (A) => Boolean): ZStreamChunk[R, E, A]
Takes all elements of the stream for as long as the specified predicate evaluates to
true. - final def tap[R1 <: R, E1 >: E](f0: (A) => ZIO[R1, E1, Any]): ZStreamChunk[R1, E1, A]
Adds an effect to consumption of every element of the stream.
- def toInputStream(implicit ev0: <:<[E, Throwable], ev1: <:<[A, Byte]): ZManaged[R, E, InputStream]
- Annotations
- @silent("never used")
- final def toQueue[E1 >: E, A1 >: A](capacity: Int = 2): ZManaged[R, Nothing, Queue[Take[E1, Chunk[A1]]]]
Converts the stream to a managed queue.
Converts the stream to a managed queue. After managed the queue is used, the queue will never again produce chunks and should be discarded.
- final def toQueueUnbounded[E1 >: E, A1 >: A]: ZManaged[R, Nothing, Queue[Take[E1, Chunk[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.
- final def toQueueWith[R1 <: R, E1 >: E, A1 >: A, Z](f: (Queue[Take[E1, Chunk[A1]]]) => ZIO[R1, E1, Z], capacity: Int = 1): ZIO[R1, E1, Z]
Converts the stream to a managed queue and immediately consume its elements.
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def via[R2, E2, B](f: (ZStreamChunk[R, E, A]) => ZStreamChunk[R2, E2, B]): ZStreamChunk[R2, E2, B]
Threads the stream through the transformation function
f. - final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def zipWithIndex: ZStreamChunk[R, E, (A, Long)]
Zips this stream together with the index of elements of the stream across chunks.
Deprecated Value Members
- final def provideM[E1 >: E](r: IO[E1, R])(implicit ev: NeedsEnv[R]): StreamChunk[E1, A]
An effectful version of
provide, useful when the act of provision requires an effect.An effectful version of
provide, useful when the act of provision requires an effect.- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use provideLayer
- final def provideManaged[E1 >: E](m: Managed[E1, R])(implicit ev: NeedsEnv[R]): StreamChunk[E1, A]
Uses the given Managed to provide the environment required to run this stream, leaving no outstanding environments.
Uses the given Managed to provide the environment required to run this stream, leaving no outstanding environments.
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use provideLayer
- final def provideSomeM[R0, E1 >: E](env: ZIO[R0, E1, R])(implicit ev: NeedsEnv[R]): ZStreamChunk[R0, E1, A]
Effectfully provides some of the environment required to run this effect leaving the remainder
R0.Effectfully provides some of the environment required to run this effect leaving the remainder
R0.- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use provideSomeLayer
- final def provideSomeManaged[R0, E1 >: E](env: ZManaged[R0, E1, R])(implicit ev: NeedsEnv[R]): ZStreamChunk[R0, E1, A]
Uses the given Managed to provide some of the environment required to run this stream, leaving the remainder
R0.Uses the given Managed to provide some of the environment required to run this stream, leaving the remainder
R0.- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0) use provideSomeLayer