Class ProtonDecoderState

  • All Implemented Interfaces:

    public final class ProtonDecoderState
    extends java.lang.Object
    implements DecoderState
    State object used by the Built in Decoder implementation.
    • Constructor Detail

      • ProtonDecoderState

        public ProtonDecoderState​(ProtonDecoder decoder)
        Create a new DecoderState instance that is joined forever to the given Decoder.
        decoder - The Decoder that this state instance is assigned to.
    • Method Detail

      • getStringDecoder

        public UTF8Decoder getStringDecoder()
        the currently set custom UTF-8 String decoder or null if non set.
      • setStringDecoder

        public ProtonDecoderState setStringDecoder​(UTF8Decoder stringDecoder)
        Sets a custom UTF-8 String decoder that will be used for all String decoding done from the encoder associated with this DecoderState instance. If no decoder is registered then the implementation uses its own decoding algorithm.
        stringDecoder - a custom UTF8Decoder that will be used for all String decoding.
        this Decoder instance.
      • decodeUTF8

        public java.lang.String decodeUTF8​(ProtonBuffer buffer,
                                           int length)
                                    throws DecodeException
        Description copied from interface: DecoderState
        Given a set of UTF-8 encoded bytes decode and return the String that represents that UTF-8 value.
        Specified by:
        decodeUTF8 in interface DecoderState
        buffer - A buffer containing the UTF-8 encoded bytes to be decoded.
        length - The number of bytes in the passed buffer that comprise the UTF-8 encoding.
        a String that represents the UTF-8 decoded bytes.
        DecodeException - if an error occurs while decoding the string value.