zio.blocks.streams.io
Members list
Type members
Classlikes
Attributes
- Companion
- class
- Source
- Reader.scala
- Supertypes
- Self type
-
Reader.type
A pull-based source of elements. Returns elements until closed.
A pull-based source of elements. Returns elements until closed.
==Thread safety== Reader instances are ''not'' thread-safe. They are designed for single-threaded, pull-based consumption. Do not share a Reader across threads without external synchronization.
==Termination== The read method returns elements while available, or a caller-chosen sentinel when closed. For errors, read throws — either the raw exception, or a StreamError wrapping non-Throwable error values. See zio.blocks.streams.internal.StreamError.
==Sentinel-return protocol== Specialized methods (readInt, readLong, etc.) widen the return type and use a caller-chosen sentinel for end-of-stream. These are the hot-path zero-boxing pull methods.
'''Sentinel choice:''' The Int lane uses Long.MinValue (safe because no Int value widens to Long.MinValue). Long and Double paths that must distinguish end-of-stream use the identity-only EndOfStream marker so every value remains representable. The Float lane uses Double.MaxValue (safe because Float.MaxValue widened to Double is distinct from Double.MaxValue).
==Laws==
isClosedis monotone: oncetrueit never returnsfalse.- When
isClosedand buffer is empty:read(sentinel)returns the sentinel.
Type parameters
- Elem
-
Element type produced by this reader.
Attributes
- Companion
- object
- Source
- Reader.scala
- Supertypes
- Known subtypes
Companion object for Writer. Provides factory constructors for common sinks: closed, single, limited, fromOutputStream, and fromWriter.
Companion object for Writer. Provides factory constructors for common sinks: closed, single, limited, fromOutputStream, and fromWriter.
Attributes
- Companion
- class
- Source
- Writer.scala
- Supertypes
- Self type
-
Writer.type
The write-side dual of Reader: a producer pushes elements and observes when the channel is done. Used internally by channel-based implementations and available directly for push-based integration.
The write-side dual of Reader: a producer pushes elements and observes when the channel is done. Used internally by channel-based implementations and available directly for push-based integration.
==Thread safety== Writer instances are ''not'' thread-safe unless otherwise documented. They are designed for single-threaded push-based production.
==Termination== A writer is closed by calling close (clean) or fail (with error). After close, write returns false. After fail, subclasses that override fail may cause write to throw the stored error; the default fail simply delegates to close. Both are idempotent; only the first call wins.
==Laws==
isClosedis monotone: oncetrueit never returnsfalse.- After
isClosed:writereturnsfalse(clean close) or throws (error close, if the subclass implements error storage via fail).
Type parameters
- Elem
-
Element type (contravariant).
Attributes
- Companion
- object
- Source
- Writer.scala
- Supertypes