Module swim.codec
Package swim.codec

Class DynamicDecoder<O>

java.lang.Object
swim.codec.Decoder<O>
swim.codec.DynamicDecoder<O>

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

    Fields
    Modifier and Type
    Field
    Description
    protected Decoder<? extends O>
    Current decoder continuation.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the decoded result.
    protected abstract void
    didDecode(O value)
    Lifecycle callback invoked after this DynamicDecoder has finished decoding a value.
    protected abstract Decoder<? extends O>
    Returns a new Decoder continuation for this DynamicDecoder, or null if this DynamicDecoder is done.
    Incrementally decodes as much input buffer data as possible, and returns another Decoder that represents the continuation of how to decode additional buffer data.
    fork(Object condition)
    Returns a Decoder continuation whose behavior may be altered by the given out-of-band condition.
    Returns the decode error.

    Methods inherited from class swim.codec.Decoder

    asError, done, done, error, isCont, isDone, isError

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • decoding

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

    • DynamicDecoder

      public DynamicDecoder()
  • Method Details

    • 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.