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
- Graph
-
- Supertypes
Members list
Value members
Abstract methods
Attributes
- Source
- Writer.scala
true once the writer is closed.
Writes one element. Returns true on success, false if the writer is closed. Implementations backed by bounded buffers may block until space is available. Throws if the writer was closed with an error via fail.
Writes one element. Returns true on success, false if the writer is closed. Implementations backed by bounded buffers may block until space is available. Throws if the writer was closed with an error via fail.
Attributes
- Source
- Writer.scala
Concrete methods
Alias for concat.
Deferred, cancellable mirror of close.
Returns a Writer that writes to this until it closes, then transparently switches to next. If this closes with an error, the error is propagated immediately without consulting next.
Returns a Writer that writes to this until it closes, then transparently switches to next. If this closes with an error, the error is propagated immediately without consulting next.
The dual of Reader.concat.
Attributes
- Source
- Writer.scala
Returns a Writer that transforms incoming elements with g before passing them to this writer. All other operations (isClosed, close, fail) delegate unchanged.
Returns a Writer that transforms incoming elements with g before passing them to this writer. All other operations (isClosed, close, fail) delegate unchanged.
Attributes
- Source
- Writer.scala
Closes the writer with an error. After this call, isClosed returns true. Subclasses that override this method may cause write to throw error on subsequent calls; the default simply delegates to close. Close and fail are idempotent; only the first call wins.
Closes the writer with an error. After this call, isClosed returns true. Subclasses that override this method may cause write to throw error on subsequent calls; the default simply delegates to close. Close and fail are idempotent; only the first call wins.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of fail.
Deferred, cancellable mirror of isClosed.
The primitive type of elements in this writer, or AnyRef for reference types.
The primitive type of elements in this writer, or AnyRef for reference types.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of jvmType.
Writes every element in chunk. Returns the suffix not delivered. If the writer is already closed, returns the entire chunk. Exceptions from individual writes propagate to the caller.
Writes every element in chunk. Returns the suffix not delivered. If the writer is already closed, returns the entire chunk. Exceptions from individual writes propagate to the caller.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeAll.
Deferred, cancellable mirror of write.
Specialized Boolean write. Default delegates to generic write. Requires implicit evidence that Boolean is a subtype of Elem.
Specialized Boolean write. Default delegates to generic write. Requires implicit evidence that Boolean is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeBoolean.
Blocking byte write. Equivalent to write(b.asInstanceOf[Elem]) but avoids boxing when Elem = Byte. Returns false if the writer is closed. Requires implicit evidence that Byte is a subtype of Elem.
Blocking byte write. Equivalent to write(b.asInstanceOf[Elem]) but avoids boxing when Elem = Byte. Returns false if the writer is closed. Requires implicit evidence that Byte is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeByte.
Blocking bulk byte write. Calls writeByte for each byte in buf[offset, offset+len), stopping early if the channel closes. Returns the number of bytes successfully written, which may be less than len if the channel closes mid-way. Requires implicit evidence that Byte is a subtype of Elem.
Blocking bulk byte write. Calls writeByte for each byte in buf[offset, offset+len), stopping early if the channel closes. Returns the number of bytes successfully written, which may be less than len if the channel closes mid-way. Requires implicit evidence that Byte is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeBytes.
Specialized Char write. Default delegates to generic write. Requires implicit evidence that Char is a subtype of Elem.
Specialized Char write. Default delegates to generic write. Requires implicit evidence that Char is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeChar.
Specialized Double write. Default delegates to generic write. Requires implicit evidence that Double is a subtype of Elem.
Specialized Double write. Default delegates to generic write. Requires implicit evidence that Double is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeDouble.
Specialized Float write. Default delegates to generic write. Requires implicit evidence that Float is a subtype of Elem.
Specialized Float write. Default delegates to generic write. Requires implicit evidence that Float is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeFloat.
Specialized Int write. Default delegates to generic write. Requires implicit evidence that Int is a subtype of Elem.
Specialized Int write. Default delegates to generic write. Requires implicit evidence that Int is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeInt.
Specialized Long write. Default delegates to generic write. Requires implicit evidence that Long is a subtype of Elem.
Specialized Long write. Default delegates to generic write. Requires implicit evidence that Long is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeLong.
Specialized Short write. Default delegates to generic write. Requires implicit evidence that Short is a subtype of Elem.
Specialized Short write. Default delegates to generic write. Requires implicit evidence that Short is a subtype of Elem.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeShort.
Returns true if the next write would accept a value without blocking (space is available and the writer is not closed). Default implementation returns !isClosed. Subclasses backed by bounded buffers should override for accuracy.
Returns true if the next write would accept a value without blocking (space is available and the writer is not closed). Default implementation returns !isClosed. Subclasses backed by bounded buffers should override for accuracy.
Attributes
- Source
- Writer.scala
Deferred, cancellable mirror of writeable.