- java.lang.Object
-
- swim.codec.Encoder<I,O>
-
- swim.codec.DynamicEncoder<I,O>
-
-
Constructor Summary
Constructors Constructor Description DynamicEncoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description O
bind()
Returns the encoded result.protected abstract void
didEncode(O value)
Lifecycle callback invoked after thisDynamicEncoder
has finished encoding avalue
.protected abstract Encoder<? super I,? extends O>
doEncode()
Returns a newEncoder
continuation for thisDynamicEncoder
, ornull
if thisDynamicEncoder
is done.Encoder<I,O>
feed(I input)
Returns anEncoder
that represents the continuation of how to encode the giveninput
object.Encoder<I,O>
fork(Object condition)
Returns anEncoder
continuation whose behavior may be altered by the given out-of-bandcondition
.Encoder<I,O>
pull(OutputBuffer<?> output)
Incrementally encodes as muchoutput
buffer data as possible, and returns anotherEncoder
that represents the continuation of how to write additional buffer data.Throwable
trap()
Returns the encode error.
-
-
-
Method Detail
-
feed
public Encoder<I,O> feed(I input)
Description copied from class:Encoder
Returns anEncoder
that represents the continuation of how to encode the giveninput
object.
-
pull
public Encoder<I,O> pull(OutputBuffer<?> output)
Description copied from class:Encoder
Incrementally encodes as muchoutput
buffer data as possible, and returns anotherEncoder
that represents the continuation of how to write additional buffer data. IfisLast
istrue
, thenpull
must return a terminatedEncoder
, i.e. anEncoder
in the done state, or in the error state. The givenoutput
buffer is only guaranteed to be valid for the duration of the method call; references tooutput
must not be stored.
-
fork
public Encoder<I,O> fork(Object condition)
Description copied from class:Encoder
Returns anEncoder
continuation whose behavior may be altered by the given out-of-bandcondition
.
-
bind
public O bind()
Description copied from class:Encoder
Returns the encoded result. Only guaranteed to return a result when in the done state.
-
trap
public Throwable trap()
Description copied from class:Encoder
Returns the encode error. Only guaranteed to return an error when in the error state.
-
doEncode
protected abstract Encoder<? super I,? extends O> doEncode()
Returns a newEncoder
continuation for thisDynamicEncoder
, ornull
if thisDynamicEncoder
is done.
-
didEncode
protected abstract void didEncode(O value)
Lifecycle callback invoked after thisDynamicEncoder
has finished encoding avalue
.
-
-