Class ProtonEncoderState

  • All Implemented Interfaces:
    EncoderState

    public final class ProtonEncoderState
    extends java.lang.Object
    implements EncoderState
    State object used by the Built in Encoder implementation.
    • Method Detail

      • getUTF8Encoder

        public UTF8Encoder getUTF8Encoder()
        Returns:
        the user configured custom UTF8Encoder instance or null if none set.
      • setUTF8Encoder

        public ProtonEncoderState setUTF8Encoder​(UTF8Encoder utf8Encoder)
        Configures a custom UTF8Encoder instance that will be used for all String decoding done by the parent Encoder instance.
        Parameters:
        utf8Encoder - The user specified UTF8Encoder or null to clear a previous configuration.
        Returns:
        this Encoder instance.
      • encodeUTF8

        public ProtonBuffer encodeUTF8​(ProtonBuffer buffer,
                                       java.lang.CharSequence sequence)
        Description copied from interface: EncoderState
        Encodes the given sequence of characters in UTF8 to the given buffer.
        Specified by:
        encodeUTF8 in interface EncoderState
        Parameters:
        buffer - A ProtonBuffer where the UTF-8 encoded bytes should be written.
        sequence - A CharSequence representing the UTF-8 bytes to encode
        Returns:
        a reference to the encoding buffer for chaining