Returns the implementation-defined result of writing the output.
Returns an implementation-defined branch of the token stream.
Writes any internally buffered state to the underlying output stream.
Returns true
when the next write(number) will succeed.
i.e. this Output
is in the cont state.
Returns true
when no write
will ever again suucced.
i.e. this Output
is in the done state.
Returns true
when an immediate write
will fail due to an
error with the token stream. i.e. this Output
is in the error
state.
When true
, trap()
will return the output error.
Returns true
when an immediate write
will fail, but writes may succeed
at some point in the future. i.e. this Output
is in the full state.
Returns true
if this is a partial Output
that will enter
the full
state when it is unable to write additional tokens.
Returns a partial Output
equivalent to this Output
, if
isPart
is true
; returns a final Output
equivalent
to this Output
if isPart
is false
. The caller's reference
to this
Output
should be replaced by the returned Output
.
Returns the OutputSettings
used to configure the behavior of output
producers that write to this Output
.
Updates the settings
associated with this Output
.
this
Returns the output error. Only guaranteed to return an error when in the error state.
Writes the code points of the given string
, followed by the code points
of the settings
' [[OutputSettings.lineSeparator line separator].
Assumes this is a Unicode Output
writer with sufficient capacity.
this
Returns an Output
in the done state, that binds the given value
,
with the given settings
.
Return an Output
in the error state, that binds the given value
,
with the given settings
.
Return an Output
in the full state, that binds the given value
,
with the given settings
.
Non-blocking token stream writer.
Output
enables incremental, interruptible writing of network protocols and data formats.Output tokens
Output tokens are modeled as primitive numbers, commonly representing Unicode code points, or raw octets; each
Output
implementation specifies the semantic type of its tokens.Output states
An
Output
writer is always in one of three states: cont_inue, _full, or done. The cont state indicates that the stream is ready to write a single token; the full state indicates that the stream is unable to write additional tokens at this time, but that the stream may logically resume at some point in the future; and the done state indicates that the stream has terminated, and that bind will return the output result. isCont returnstrue
when in the cont state; isFull returnstrue
when in the full state; and isDone returnstrue
when in the done state.Output results
An
Output
writer yields a value of typeT
, obtained via the bind method, representing some implementation defined result of writing the output. For example, anOutput<string>
implementation may–but is not required to–yield astring
containing all code points written to the output.Non-blocking behavior
Output
writers never block. AnOutput
writer that would otherwise block writing additional output instead enters the full state, signaling the output generator to back off producing the output, but to remain prepared to produce additional output in the future. AnOutput
writer enters the done state when it encounters the final end of its output, signaling to the output generator to stop producing.Output settings
An output generator may alter the tokens it produces based on its
Output
writer's settings. Uses include pretty printing and styling generated output. OutputSettings subclasses can provide additional parameters understood by specialized output producers.Cloning
An
Output
writer may be cloned to branch the token stream in an implementation specified manner. Not allOutput
implementations support cloning.OutputSettings
Writer