- java.lang.Object
-
- swim.codec.Decoder<O>
-
- swim.codec.DynamicDecoder<O>
-
-
Constructor Summary
Constructors Constructor Description DynamicDecoder()
-
Method Summary
Modifier and Type Method Description Obind()Returns the decoded result.protected abstract voiddidDecode(O value)Lifecycle callback invoked after thisDynamicDecoderhas finished decoding avalue.protected abstract Decoder<? extends O>doDecode()Returns a newDecodercontinuation for thisDynamicDecoder, ornullif thisDynamicDecoderis done.Decoder<O>feed(InputBuffer input)Incrementally decodes as muchinputbuffer data as possible, and returns anotherDecoderthat represents the continuation of how to decode additional buffer data.Decoder<O>fork(Object condition)Returns aDecodercontinuation whose behavior may be altered by the given out-of-bandcondition.Throwabletrap()Returns the decode error.
-
-
-
Method Detail
-
feed
public Decoder<O> feed(InputBuffer input)
Description copied from class:DecoderIncrementally decodes as muchinputbuffer data as possible, and returns anotherDecoderthat represents the continuation of how to decode additional buffer data. IfisLastistrue, thenfeedmust return a terminatedDecoder, i.e. aDecoderin the done state, or in the error state. The giveninputbuffer is only guaranteed to be valid for the duration of the method call; references toinputmust not be stored.
-
fork
public Decoder<O> fork(Object condition)
Description copied from class:DecoderReturns aDecodercontinuation whose behavior may be altered by the given out-of-bandcondition.
-
bind
public O bind()
Description copied from class:DecoderReturns the decoded result. Only guaranteed to return a result when in the done state.
-
trap
public Throwable trap()
Description copied from class:DecoderReturns the decode error. Only guaranteed to return an error when in the error state.
-
doDecode
protected abstract Decoder<? extends O> doDecode()
Returns a newDecodercontinuation for thisDynamicDecoder, ornullif thisDynamicDecoderis done.
-
didDecode
protected abstract void didDecode(O value)
Lifecycle callback invoked after thisDynamicDecoderhas finished decoding avalue.
-
-