Class ProtonStreamDecoderState
- java.lang.Object
-
- org.apache.qpid.protonj2.codec.decoders.ProtonStreamDecoderState
-
- All Implemented Interfaces:
StreamDecoderState
public final class ProtonStreamDecoderState extends java.lang.Object implements StreamDecoderState
State object used by the Built in Decoder implementation.
-
-
Constructor Summary
Constructors Constructor Description ProtonStreamDecoderState(ProtonStreamDecoder decoder)
Create a newStreamDecoderState
instance that is joined forever to the givenDecoder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
decodeUTF8(java.io.InputStream stream, int length)
Given a stream that will provide UTF-8 encoded bytes, decode and return the String that represents that UTF-8 value.ProtonStreamDecoder
getDecoder()
UTF8StreamDecoder
getStringDecoder()
ProtonStreamDecoderState
reset()
Resets any intermediate state back to default values.void
setStringDecoder(UTF8StreamDecoder stringDecoder)
Sets a custom UTF-8String
decoder that will be used for allString
decoding done from the encoder associated with thisStreamDecoderState
instance.
-
-
-
Constructor Detail
-
ProtonStreamDecoderState
public ProtonStreamDecoderState(ProtonStreamDecoder decoder)
Create a newStreamDecoderState
instance that is joined forever to the givenDecoder
.- Parameters:
decoder
- TheStreamDecoder
that this state instance is assigned to.
-
-
Method Detail
-
getDecoder
public ProtonStreamDecoder getDecoder()
- Specified by:
getDecoder
in interfaceStreamDecoderState
- Returns:
- the
StreamDecoder
that created this state object
-
reset
public ProtonStreamDecoderState reset()
Description copied from interface:StreamDecoderState
Resets any intermediate state back to default values.- Specified by:
reset
in interfaceStreamDecoderState
- Returns:
- this
StreamDecoderState
instance.
-
getStringDecoder
public UTF8StreamDecoder getStringDecoder()
- Returns:
- the currently set custom UTF-8
String
decoder or null if non set.
-
setStringDecoder
public void setStringDecoder(UTF8StreamDecoder stringDecoder)
Sets a custom UTF-8String
decoder that will be used for allString
decoding done from the encoder associated with thisStreamDecoderState
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.
-
decodeUTF8
public java.lang.String decodeUTF8(java.io.InputStream stream, int length) throws DecodeException
Description copied from interface:StreamDecoderState
Given a stream that will provide UTF-8 encoded bytes, decode and return the String that represents that UTF-8 value.- Specified by:
decodeUTF8
in interfaceStreamDecoderState
- Parameters:
stream
- A stream from which the UTF-8 encoded bytes are to be decoded.length
- The number of bytes in the passedInputStream
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.
-
-