- 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 Obind()Returns the encoded result.protected abstract voiddidEncode(O value)Lifecycle callback invoked after thisDynamicEncoderhas finished encoding avalue.protected abstract Encoder<? super I,? extends O>doEncode()Returns a newEncodercontinuation for thisDynamicEncoder, ornullif thisDynamicEncoderis done.Encoder<I,O>feed(I input)Returns anEncoderthat represents the continuation of how to encode the giveninputobject.Encoder<I,O>fork(Object condition)Returns anEncodercontinuation whose behavior may be altered by the given out-of-bandcondition.Encoder<I,O>pull(OutputBuffer<?> output)Incrementally encodes as muchoutputbuffer data as possible, and returns anotherEncoderthat represents the continuation of how to write additional buffer data.Throwabletrap()Returns the encode error.
-
-
-
Method Detail
-
feed
public Encoder<I,O> feed(I input)
Description copied from class:EncoderReturns anEncoderthat represents the continuation of how to encode the giveninputobject.
-
pull
public Encoder<I,O> pull(OutputBuffer<?> output)
Description copied from class:EncoderIncrementally encodes as muchoutputbuffer data as possible, and returns anotherEncoderthat represents the continuation of how to write additional buffer data. IfisLastistrue, thenpullmust return a terminatedEncoder, i.e. anEncoderin the done state, or in the error state. The givenoutputbuffer is only guaranteed to be valid for the duration of the method call; references tooutputmust not be stored.
-
fork
public Encoder<I,O> fork(Object condition)
Description copied from class:EncoderReturns anEncodercontinuation whose behavior may be altered by the given out-of-bandcondition.
-
bind
public O bind()
Description copied from class:EncoderReturns the encoded result. Only guaranteed to return a result when in the done state.
-
trap
public Throwable trap()
Description copied from class:EncoderReturns 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 newEncodercontinuation for thisDynamicEncoder, ornullif thisDynamicEncoderis done.
-
didEncode
protected abstract void didEncode(O value)
Lifecycle callback invoked after thisDynamicEncoderhas finished encoding avalue.
-
-