SyncInterpreter
An optimized interpreter that compiles a chain of stream operations (map, filter, flatMap, source reads) into a flat-array representation for efficient dispatch. This is the fallback compilation strategy for deep pipelines (beyond Stream.DepthCutoff) and is used by SyncInterpreter.fromStream.
Internally, each op is a (Long, AnyRef) pair stored at the same index in two parallel arrays. The Long's bottom 8 bits hold the OpTag; the upper 56 bits hold StreamState for Read/Push ops.
Attributes
- Source
- SyncInterpreter.scala
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Signals close from the consumer side. Implementations should set internal closed state and wake any blocked readers.
Signals close from the consumer side. Implementations should set internal closed state and wake any blocked readers.
Attributes
- Source
- SyncInterpreter.scala
true once the reader is closed. Reflects the state machine; does not imply the buffer is empty.
true once the reader is closed. Reflects the state machine; does not imply the buffer is empty.
Attributes
- Source
- SyncInterpreter.scala
The primitive type of elements in this reader, or AnyRef for reference types. Specialized subclasses override this to enable zero-boxing pull paths via readIntPhysical(), readLongPhysical(), etc.
The primitive type of elements in this reader, or AnyRef for reference types. Specialized subclasses override this to enable zero-boxing pull paths via readIntPhysical(), readLongPhysical(), etc.
Attributes
- Definition Classes
-
SyncReader -> Reader
- Source
- SyncInterpreter.scala
Attributes
- Source
- SyncInterpreter.scala
Reads the next element, or returns sentinel if the stream is closed. The caller passes a sentinel value that can never appear as a real element; getting it back means the stream is exhausted.
Reads the next element, or returns sentinel if the stream is closed. The caller passes a sentinel value that can never appear as a real element; getting it back means the stream is exhausted.
Attributes
- Source
- SyncInterpreter.scala
Sentinel-return Boolean pull. Returns 1 for true, 0 for false, or sentinel when closed and empty. Sentinel must be outside [0, 1]. A typical sentinel is -1. Requires implicit evidence that Elem is a subtype of Boolean.
Sentinel-return Boolean pull. Returns 1 for true, 0 for false, or sentinel when closed and empty. Sentinel must be outside [0, 1]. A typical sentinel is -1. Requires implicit evidence that Elem is a subtype of Boolean.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Reads a single byte, returning -1 when closed. Default delegates to read and extracts the low byte. Byte-specialized readers override for efficiency.
Reads a single byte, returning -1 when closed. Default delegates to read and extracts the low byte. Byte-specialized readers override for efficiency.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Box-free bulk byte pull into a caller-supplied buffer. Requires compile-time evidence that this reader's element type is Byte.
Box-free bulk byte pull into a caller-supplied buffer. Requires compile-time evidence that this reader's element type is Byte.
Contract mirrors java.io.InputStream.read(byte[], int, int):
- Blocks until at least 1 byte is available.
- Returns the number of bytes read (`1 0) process(buf, 0, n) }}}
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Char pull. Returns element widened to Int, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Char.
Sentinel-return Char pull. Returns element widened to Int, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Char.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Double pull. Returns element widened/exact, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Double.
Sentinel-return Double pull. Returns element widened/exact, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Double.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Box-free bulk Double pull into a caller-supplied buffer.
Box-free bulk Double pull into a caller-supplied buffer.
Contract mirrors readBytes:
- Blocks until at least 1 element is available.
- Returns the number of elements read (
1 <= r <= maxLen). - Returns
-1when closed and empty. - Returns
0immediately whenmaxLen == 0.
Value parameters
- buf
-
destination array
- maxLen
-
maximum number of elements to read
- offset
-
starting position in
buf
Attributes
- Returns
-
number of elements read,
-1on end-of-stream, or0whenmaxLen == 0 - Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Float pull. Returns element widened to Double, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Float.
Sentinel-return Float pull. Returns element widened to Double, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Float.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Box-free bulk Float pull into a caller-supplied buffer.
Box-free bulk Float pull into a caller-supplied buffer.
Contract mirrors readBytes:
- Blocks until at least 1 element is available.
- Returns the number of elements read (
1 <= r <= maxLen). - Returns
-1when closed and empty. - Returns
0immediately whenmaxLen == 0.
Value parameters
- buf
-
destination array
- maxLen
-
maximum number of elements to read
- offset
-
starting position in
buf
Attributes
- Returns
-
number of elements read,
-1on end-of-stream, or0whenmaxLen == 0 - Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Int pull. Returns the element widened to Long, or sentinel when closed and empty. The sentinel must lie outside [Int.MinValue, Int.MaxValue] (e.g. Long.MinValue). Requires implicit evidence that Elem is a subtype of Int.
Sentinel-return Int pull. Returns the element widened to Long, or sentinel when closed and empty. The sentinel must lie outside [Int.MinValue, Int.MaxValue] (e.g. Long.MinValue). Requires implicit evidence that Elem is a subtype of Int.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Box-free bulk Int pull into a caller-supplied buffer.
Box-free bulk Int pull into a caller-supplied buffer.
Contract mirrors readBytes:
- Blocks until at least 1 element is available.
- Returns the number of elements read (
1 <= r <= maxLen). - Returns
-1when closed and empty. - Returns
0immediately whenmaxLen == 0.
Value parameters
- buf
-
destination array
- maxLen
-
maximum number of elements to read
- offset
-
starting position in
buf
Attributes
- Returns
-
number of elements read,
-1on end-of-stream, or0whenmaxLen == 0 - Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Long pull. Returns the element, or sentinel when closed and empty. The sentinel must be a value that never appears in the stream (e.g. Long.MaxValue). Requires implicit evidence that Elem is a subtype of Long.
Sentinel-return Long pull. Returns the element, or sentinel when closed and empty. The sentinel must be a value that never appears in the stream (e.g. Long.MaxValue). Requires implicit evidence that Elem is a subtype of Long.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Box-free bulk Long pull into a caller-supplied buffer.
Box-free bulk Long pull into a caller-supplied buffer.
Contract mirrors readBytes:
- Blocks until at least 1 element is available.
- Returns the number of elements read (
1 <= r <= maxLen). - Returns
-1when closed and empty. - Returns
0immediately whenmaxLen == 0.
Value parameters
- buf
-
destination array
- maxLen
-
maximum number of elements to read
- offset
-
starting position in
buf
Attributes
- Returns
-
number of elements read,
-1on end-of-stream, or0whenmaxLen == 0 - Definition Classes
- Source
- SyncInterpreter.scala
Reads at most n elements into a Chunk, returning early if the reader is exhausted. Returns Chunk.empty when n <= 0 or the reader is already closed. Dispatches on jvmType for zero-boxing on primitive streams.
Reads at most n elements into a Chunk, returning early if the reader is exhausted. Returns Chunk.empty when n <= 0 or the reader is already closed. Dispatches on jvmType for zero-boxing on primitive streams.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Sentinel-return Short pull. Returns element widened to Int, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Short.
Sentinel-return Short pull. Returns element widened to Int, or sentinel when closed. Requires implicit evidence that Elem is a subtype of Short.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Reads up to n elements that are currently available. Blocks for at least 1 element if none are ready yet. Returns fewer than n if fewer are available without additional blocking. Returns Chunk.empty if n <= 0 or if the reader is closed and empty.
Reads up to n elements that are currently available. Blocks for at least 1 element if none are ready yet. Returns fewer than n if fewer are available without additional blocking. Returns Chunk.empty if n <= 0 or if the reader is closed and empty.
Differs from readN in that readN blocks until exactly n elements have been read. readUpToN returns as soon as at least one element is read, without waiting for further elements.
Value parameters
- n
-
maximum number of elements to read
Attributes
- Returns
-
a Chunk with between 1 and
nelements, or empty on EOS - Definition Classes
- Source
- SyncInterpreter.scala
Returns true if the next read() / readIntPhysical() etc. would return a value (not closed/sentinel). Default implementation returns !isClosed. Subclasses with buffered state should override for accuracy.
Returns true if the next read() / readIntPhysical() etc. would return a value (not closed/sentinel). Default implementation returns !isClosed. Subclasses with buffered state should override for accuracy.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Rewinds this reader to its initial state, as if freshly constructed. After reset(), all elements are available again from the beginning.
Rewinds this reader to its initial state, as if freshly constructed. After reset(), all elements are available again from the beginning.
Not all readers support this. Readers backed by one-shot resources (InputStreams, java.io.Readers) throw UnsupportedOperationException.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Attempts to set a limit on this reader so it produces at most n elements. Returns true if the reader handled it natively (O(1), zero per-element cost), false if it cannot. When true, the reader will produce at most limit elements before reporting closed. After reset(), the limit is re-applied from the new start position.
Attempts to set a limit on this reader so it produces at most n elements. Returns true if the reader handled it natively (O(1), zero per-element cost), false if it cannot. When true, the reader will produce at most limit elements before reporting closed. After reset(), the limit is re-applied from the new start position.
Default returns false — most readers don't support native pushdown.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Attempts to set this reader into repeat-forever mode, so it restarts from the beginning whenever it would otherwise close. Returns true if the reader handled it natively, false if the caller must wrap in a repeating wrapper.
Attempts to set this reader into repeat-forever mode, so it restarts from the beginning whenever it would otherwise close. Returns true if the reader handled it natively, false if the caller must wrap in a repeating wrapper.
Default returns false.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Attempts to set a skip (drop) on this reader. Returns true if the reader handled it natively (O(1), zero per-element cost), false if it cannot. When true, the next skip elements will be skipped before producing. After reset(), the skip is re-applied.
Attempts to set a skip (drop) on this reader. Returns true if the reader handled it natively (O(1), zero per-element cost), false if it cannot. When true, the next skip elements will be skipped before producing. After reset(), the skip is re-applied.
Default returns false — most readers don't support native pushdown.
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Eagerly discards the first n elements. Returns Unit. If the stream closes before n elements, returns early. Subclasses should override for efficient skipping (e.g. index advancement).
Eagerly discards the first n elements. Returns Unit. If the stream closes before n elements, returns early. Subclasses should override for efficient skipping (e.g. index advancement).
Attributes
- Definition Classes
- Source
- SyncInterpreter.scala
Inherited methods
Alias for concat.
Alias for concat.
Attributes
- Definition Classes
-
SyncReader -> Reader
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Definition Classes
-
SyncReader -> Reader
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Fails immediately with a trusted typed source error.
Fails immediately with a trusted typed source error.
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Drains this reader into a Chunk, consuming all remaining elements. Returns Chunk.empty when already at EOF. Dispatches on jvmType for zero-boxing on primitive streams.
Drains this reader into a Chunk, consuming all remaining elements. Returns Chunk.empty when already at EOF. Dispatches on jvmType for zero-boxing on primitive streams.
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Constructs a trusted typed source failure for custom Reader implementations.
Constructs a trusted typed source failure for custom Reader implementations.
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Wraps this reader so that release runs after close().
Wraps this reader so that release runs after close().
Value parameters
- release
-
Action to execute when this reader is closed.
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala
Attributes
- Inherited from:
- SyncReader
- Source
- Reader.scala