object ZSink extends ZSinkPlatformSpecificConstructors with Serializable
- Alphabetic
- By Inheritance
- ZSink
- Serializable
- Serializable
- ZSinkPlatformSpecificConstructors
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- implicit final class InputRemainderOps[R, E, A, B] extends AnyRef
- implicit final class InvariantOps[R, E, A0, A, B] extends AnyVal
- implicit final class NoRemainderOps[R, E, A, B] extends AnyVal
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
await[A]: ZSink[Any, Unit, Nothing, A, A]
Creates a sink that waits for a single value to be produced.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
collectAll[A]: ZSink[Any, Nothing, Nothing, A, List[A]]
Creates a sink accumulating incoming values into a list.
-
def
collectAllN[A](n: Long): ZSink[Any, Nothing, A, A, List[A]]
Creates a sink accumulating incoming values into a list of maximum size
n. -
def
collectAllToMap[K, A](key: (A) ⇒ K)(f: (A, A) ⇒ A): Sink[Nothing, Nothing, A, Map[K, A]]
Creates a sink accumulating incoming values into a map.
Creates a sink accumulating incoming values into a map. Key of each element is determined by supplied function. Combines elements with same key with supplied function f.
-
def
collectAllToMapN[K, A](n: Long)(key: (A) ⇒ K)(f: (A, A) ⇒ A): Sink[Nothing, A, A, Map[K, A]]
Creates a sink accumulating incoming values into a map of maximum size
n.Creates a sink accumulating incoming values into a map of maximum size
n. Key of each element is determined by supplied function.Combines elements with same key with supplied function f.
-
def
collectAllToSet[A]: ZSink[Any, Nothing, Nothing, A, Set[A]]
Creates a sink accumulating incoming values into a set.
-
def
collectAllToSetN[A](n: Long): ZSink[Any, Nothing, A, A, Set[A]]
Creates a sink accumulating incoming values into a set of maximum size
n. -
def
collectAllWhile[A](p: (A) ⇒ Boolean): ZSink[Any, Nothing, A, A, List[A]]
Accumulates incoming elements into a list as long as they verify predicate
p. -
def
collectAllWhileM[R, E, A](p: (A) ⇒ ZIO[R, E, Boolean]): ZSink[R, E, A, A, List[A]]
Accumulates incoming elements into a list as long as they verify effectful predicate
p. -
def
count[A]: ZSink[Any, Nothing, Nothing, A, Long]
Creates a sink which emits the number of elements processed
-
def
die(e: ⇒ Throwable): ZSink[Any, Nothing, Nothing, Any, Nothing]
Creates a sink halting with the specified
Throwable. -
def
dieMessage(m: ⇒ String): ZSink[Any, Nothing, Nothing, Any, Nothing]
Creates a sink halting with the specified message, wrapped in a
RuntimeException. -
def
drain: ZSink[Any, Nothing, Nothing, Any, Unit]
Creates a sink consuming all incoming values until completion.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fail[E](e: ⇒ E): ZSink[Any, E, Nothing, Any, Nothing]
Creates a sink failing with a value of type
E. -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
fold[A0, A, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, A) ⇒ (S, Chunk[A0])): ZSink[Any, Nothing, A0, A, S]
Creates a sink by folding over a structure of type
S. -
def
foldLeft[A, S](z: S)(f: (S, A) ⇒ S): ZSink[Any, Nothing, Nothing, A, S]
Creates a sink by folding over a structure of type
S. -
def
foldLeftM[R, E, A, S](z: S)(f: (S, A) ⇒ ZIO[R, E, S]): ZSink[R, E, Nothing, A, S]
Creates a sink by effectfully folding over a structure of type
S. -
def
foldM[R, E, A0, A, S](z: S)(contFn: (S) ⇒ Boolean)(f: (S, A) ⇒ ZIO[R, E, (S, Chunk[A0])]): ZSink[R, E, A0, A, S]
Creates a sink by effectfully folding over a structure of type
S. -
def
foldUntil[S, A](z: S, max: Long)(f: (S, A) ⇒ S): ZSink[Any, Nothing, A, A, S]
Creates a sink that folds elements of type
Ainto a structure of typeSuntilmaxelements have been folded.Creates a sink that folds elements of type
Ainto a structure of typeSuntilmaxelements have been folded.Like ZSink.foldWeighted, but with a constant cost function of 1.
-
def
foldUntilM[R, E, S, A](z: S, max: Long)(f: (S, A) ⇒ ZIO[R, E, S]): ZSink[R, E, A, A, S]
Creates a sink that effectfully folds elements of type
Ainto a structure of typeSuntilmaxelements have been folded.Creates a sink that effectfully folds elements of type
Ainto a structure of typeSuntilmaxelements have been folded.Like ZSink.foldWeightedM, but with a constant cost function of 1.
-
def
foldWeighted[A, S](z: S)(costFn: (A) ⇒ Long, max: Long)(f: (S, A) ⇒ S): ZSink[Any, Nothing, A, A, S]
Creates a sink that folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.- Note
Elements that have an individual cost larger than
maxwill cause the stream to hang. See ZSink.foldWeightedDecompose for a variant that can handle these.
-
def
foldWeightedDecompose[A, S](z: S)(costFn: (A) ⇒ Long, max: Long, decompose: (A) ⇒ Chunk[A])(f: (S, A) ⇒ S): ZSink[Any, Nothing, A, A, S]
Creates a sink that folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.The
decomposefunction will be used for decomposing elements that cause anSaggregate to crossmaxinto smaller elements. For example:Stream(1, 5, 1) .aggregate( Sink .foldWeightedDecompose(List[Int]())((i: Int) => i.toLong, 4, (i: Int) => Chunk(i - 1, 1)) { (acc, el) => el :: acc } .map(_.reverse) ) .runCollect
The stream would emit the elements
List(1), List(4), List(1, 1). The ZSink.foldWeightedDecomposeM allows the decompose function to return aZIOvalue, and consequently it allows the sink to fail. -
def
foldWeightedDecomposeM[R, R1 <: R, E, E1 >: E, A, S](z: S)(costFn: (A) ⇒ ZIO[R, E, Long], max: Long, decompose: (A) ⇒ ZIO[R, E, Chunk[A]])(f: (S, A) ⇒ ZIO[R1, E1, S]): ZSink[R1, E1, A, A, S]
Creates a sink that effectfully folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.The
decomposefunction will be used for decomposing elements that cause anSaggregate to crossmaxinto smaller elements. See ZSink.foldWeightedDecompose for an example. -
def
foldWeightedM[R, R1 <: R, E, E1 >: E, A, S](z: S)(costFn: (A) ⇒ ZIO[R, E, Long], max: Long)(f: (S, A) ⇒ ZIO[R1, E1, S]): ZSink[R1, E1, A, A, S]
Creates a sink that effectfully folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.Creates a sink that effectfully folds elements of type
Ainto a structure of typeS, untilmaxworth of elements (determined by thecostFn) have been folded.- Note
Elements that have an individual cost larger than
maxwill cause the stream to hang. See ZSink.foldWeightedDecomposeM for a variant that can handle these.
-
def
fromEffect[R, E, B](b: ⇒ ZIO[R, E, B]): ZSink[R, E, Nothing, Any, B]
Creates a single-value sink produced from an effect
-
def
fromFunction[A, B](f: (A) ⇒ B): ZSink[Any, Unit, Nothing, A, B]
Creates a sink that purely transforms incoming values.
-
def
fromFunctionM[R, E, A, B](f: (A) ⇒ ZIO[R, E, B]): ZSink[R, Option[E], Nothing, A, B]
Creates a sink that effectfully transforms incoming values.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
halt[E](e: ⇒ Cause[E]): ZSink[Any, E, Nothing, Any, Nothing]
Creates a sink halting with a specified cause.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
head[A]: ZSink[Any, Nothing, A, A, Option[A]]
Creates a sink containing the first value.
-
def
identity[A]: ZSink[Any, Unit, Nothing, A, A]
Creates a sink by that merely passes on incoming values.
-
def
ignoreWhile[A](p: (A) ⇒ Boolean): ZSink[Any, Nothing, A, A, Unit]
Creates a sink by starts consuming value as soon as one fails the predicate
p. -
def
ignoreWhileM[R, E, A](p: (A) ⇒ ZIO[R, E, Boolean]): ZSink[R, E, A, A, Unit]
Creates a sink by starts consuming value as soon as one fails the effectful predicate
p. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
last[A]: ZSink[Any, Nothing, Nothing, A, Option[A]]
Creates a sink containing the last value.
-
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()
-
def
pull1[R, R1 <: R, E, A0, A, B](end: ZIO[R1, E, B])(input: (A) ⇒ ZSink[R, E, A0, A, B]): ZSink[R1, E, A0, A, B]
Returns a sink that must at least perform one extraction or else will "fail" with
end. -
def
read1[E, A](e: (Option[A]) ⇒ E)(p: (A) ⇒ Boolean): ZSink[Any, E, A, A, A]
Creates a sink that consumes the first value verifying the predicate
por fails as soon as the sink won't make any more progress. -
val
splitLines: ZSink[Any, Nothing, String, String, Chunk[String]]
Splits strings on newlines.
Splits strings on newlines. Handles both
\r\nand\n. -
val
splitLinesChunk: ZSink[Any, Nothing, Chunk[String], Chunk[String], Chunk[String]]
Merges chunks of strings and splits them on newlines.
Merges chunks of strings and splits them on newlines. Handles both
\r\nand\n. -
def
splitOn[A](delimiter: Chunk[A], maxFrameLength: Int): ZSink[Any, IllegalArgumentException, Chunk[A], Chunk[A], Chunk[A]]
Frames a stream of chunks according to a delimiter.
Frames a stream of chunks according to a delimiter.
This is designed for use with
ZStream#aggregate. Regardless of how the input stream is chunked, the output stream will emit a single chunk for each occurrence of the delimiter. The delimiters are not included in the output.Example:
val stream = Stream(Chunk(1), Chunk(2, 3, 100), Chunk(101, 4)) val sink = ZSink.splitOn(Chunk(100, 101), 100) stream.aggregate(sink).runCollect // List(Chunk(1, 2, 3), Chunk(4))
- delimiter
The delimiter to use for framing.
- maxFrameLength
The maximum frame length allowed. If more than this many elements appears without the delimiter, this sink fails with
IllegalArgumentException. None of the chunks emitted will be larger than this.
-
def
splitOn(delimiter: String): ZSink[Any, Nothing, String, String, Chunk[String]]
Splits strings on a delimiter.
-
def
succeed[A, B](b: ⇒ B): ZSink[Any, Nothing, A, A, B]
Creates a single-value sink from a value.
-
def
sum[A](implicit ev: Numeric[A]): ZSink[Any, Nothing, Nothing, A, A]
Creates a sink which sums elements, provided they are Numeric
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
throttleEnforce[A](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ Long): ZManaged[Clock, Nothing, ZSink[Clock, Nothing, Nothing, A, Option[A]]]
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. Elements that do not meet the bandwidth constraints are dropped. The weight of each element is determined by thecostFnfunction. Elements are mapped toOption[A], andNonedenotes that a given element has been dropped. -
def
throttleEnforceM[R, E, A](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ ZIO[R, E, Long]): ZManaged[Clock, Nothing, ZSink[R with Clock, E, Nothing, A, Option[A]]]
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which throttles input elements of type A according to the given bandwidth parameters using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. Elements that do not meet the bandwidth constraints are dropped. The weight of each element is determined by thecostFneffectful function. Elements are mapped toOption[A], andNonedenotes that a given element has been dropped. -
def
throttleShape[A](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ Long): ZManaged[Clock, Nothing, ZSink[Clock, Nothing, Nothing, A, A]]
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. The weight of each element is determined by thecostFnfunction. -
def
throttleShapeM[R, E, A](units: Long, duration: Duration, burst: Long = 0)(costFn: (A) ⇒ ZIO[R, E, Long]): ZManaged[Clock, Nothing, ZSink[R with Clock, E, Nothing, A, A]]
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm.
Creates a sink which delays input elements of type A according to the given bandwidth parameters using the token bucket algorithm. The sink allows for burst in the processing of elements by allowing the token bucket to accumulate tokens up to a
units + burstthreshold. The weight of each element is determined by thecostFneffectful function. -
def
toString(): String
- Definition Classes
- AnyRef → Any
-
val
utf8DecodeChunk: ZSink[Any, Nothing, Chunk[Byte], Chunk[Byte], String]
Decodes chunks of bytes into a String.
Decodes chunks of bytes into a String.
This sink uses the String constructor's behavior when handling malformed byte sequences.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()