Class ProtonDecoderState
java.lang.Object
org.apache.qpid.protonj2.codec.decoders.ProtonDecoderState
- All Implemented Interfaces:
DecoderState
State object used by the Built in Decoder implementation.
-
Constructor Summary
ConstructorDescriptionProtonDecoderState
(ProtonDecoder decoder) Create a newDecoderState
instance that is joined forever to the givenDecoder
. -
Method Summary
Modifier and TypeMethodDescriptiondecodeUTF8
(ProtonBuffer buffer, int length) Given a set of UTF-8 encoded bytes decode and return the String that represents that UTF-8 value.reset()
Resets any intermediate state back to default values.setStringDecoder
(UTF8Decoder stringDecoder) Sets a custom UTF-8String
decoder that will be used for allString
decoding done from the encoder associated with thisDecoderState
instance.
-
Constructor Details
-
ProtonDecoderState
Create a newDecoderState
instance that is joined forever to the givenDecoder
.- Parameters:
decoder
- TheDecoder
that this state instance is assigned to.
-
-
Method Details
-
getDecoder
- Specified by:
getDecoder
in interfaceDecoderState
- Returns:
- the decoder that created this state object
-
reset
Description copied from interface:DecoderState
Resets any intermediate state back to default values.- Specified by:
reset
in interfaceDecoderState
- Returns:
- this
DecoderState
instance.
-
getStringDecoder
- Returns:
- the currently set custom UTF-8
String
decoder or null if non set.
-
setStringDecoder
Sets a custom UTF-8String
decoder that will be used for allString
decoding done from the encoder associated with thisDecoderState
instance. If no decoder is registered then the implementation uses its own decoding algorithm.- Parameters:
stringDecoder
- a customUTF8Decoder
that will be used for allString
decoding.- Returns:
- this
Decoder
instance.
-
decodeUTF8
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 interfaceDecoderState
- Parameters:
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.- Returns:
- a String that represents the UTF-8 decoded bytes.
- Throws:
DecodeException
- if an error occurs while decoding the string value.
-