Class ProtonEncoderState
- java.lang.Object
-
- org.apache.qpid.protonj2.codec.encoders.ProtonEncoderState
-
- All Implemented Interfaces:
EncoderState
public final class ProtonEncoderState extends java.lang.Object implements EncoderState
State object used by the Built in Encoder implementation.
-
-
Constructor Summary
Constructors Constructor Description ProtonEncoderState(ProtonEncoder encoder)
Creates a newProtonEncoderState
that is linked to the givenProtonEncoder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtonBuffer
encodeUTF8(ProtonBuffer buffer, java.lang.CharSequence sequence)
Encodes the given sequence of characters in UTF8 to the given buffer.ProtonEncoder
getEncoder()
UTF8Encoder
getUTF8Encoder()
ProtonEncoderState
reset()
Resets any intermediate state back to default values.ProtonEncoderState
setUTF8Encoder(UTF8Encoder utf8Encoder)
Configures a customUTF8Encoder
instance that will be used for all String decoding done by the parentEncoder
instance.
-
-
-
Constructor Detail
-
ProtonEncoderState
public ProtonEncoderState(ProtonEncoder encoder)
Creates a newProtonEncoderState
that is linked to the givenProtonEncoder
.- Parameters:
encoder
- TheEncoder
that this encoder state instance is assigned to.
-
-
Method Detail
-
getEncoder
public ProtonEncoder getEncoder()
- Specified by:
getEncoder
in interfaceEncoderState
- Returns:
- the Encoder instance that create this state object.
-
getUTF8Encoder
public UTF8Encoder getUTF8Encoder()
- Returns:
- the user configured custom
UTF8Encoder
instance or null if none set.
-
setUTF8Encoder
public ProtonEncoderState setUTF8Encoder(UTF8Encoder utf8Encoder)
Configures a customUTF8Encoder
instance that will be used for all String decoding done by the parentEncoder
instance.- Parameters:
utf8Encoder
- The user specifiedUTF8Encoder
or null to clear a previous configuration.- Returns:
- this
Encoder
instance.
-
reset
public ProtonEncoderState reset()
Description copied from interface:EncoderState
Resets any intermediate state back to default values.- Specified by:
reset
in interfaceEncoderState
- Returns:
- this
EncoderState
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 interfaceEncoderState
- Parameters:
buffer
- A ProtonBuffer where the UTF-8 encoded bytes should be written.sequence
- ACharSequence
representing the UTF-8 bytes to encode- Returns:
- a reference to the encoding buffer for chaining
-
-