Module swim.codec
Package swim.codec

Class DynamicDecoder<O>


  • public abstract class DynamicDecoder<O>
    extends Decoder<O>
    Dynamically generated Decoder continuation.
    • Field Detail

      • decoding

        protected Decoder<? extends O> decoding
        Current decoder continuation.
    • Constructor Detail

      • DynamicDecoder

        public DynamicDecoder()
    • Method Detail

      • feed

        public Decoder<O> feed​(InputBuffer input)
        Description copied from class: Decoder
        Incrementally decodes as much input buffer data as possible, and returns another Decoder that represents the continuation of how to decode additional buffer data. If isLast is true, then feed must return a terminated Decoder, i.e. a Decoder in the done state, or in the error state. The given input buffer is only guaranteed to be valid for the duration of the method call; references to input must not be stored.
        Specified by:
        feed in class Decoder<O>
      • fork

        public Decoder<O> fork​(Object condition)
        Description copied from class: Decoder
        Returns a Decoder continuation whose behavior may be altered by the given out-of-band condition.
        Overrides:
        fork in class Decoder<O>
      • bind

        public O bind()
        Description copied from class: Decoder
        Returns the decoded result. Only guaranteed to return a result when in the done state.
        Overrides:
        bind in class Decoder<O>
      • trap

        public Throwable trap()
        Description copied from class: Decoder
        Returns the decode error. Only guaranteed to return an error when in the error state.
        Overrides:
        trap in class Decoder<O>
      • doDecode

        protected abstract Decoder<? extends O> doDecode()
        Returns a new Decoder continuation for this DynamicDecoder, or null if this DynamicDecoder is done.
      • didDecode

        protected abstract void didDecode​(O value)
        Lifecycle callback invoked after this DynamicDecoder has finished decoding a value.