Class ProtonStreamDecoderState
- java.lang.Object
- 
- org.apache.qpid.protonj2.codec.decoders.ProtonStreamDecoderState
 
- 
- All Implemented Interfaces:
- StreamDecoderState
 
 public final class ProtonStreamDecoderState extends Object implements StreamDecoderState State object used by the Built in Decoder implementation.
- 
- 
Constructor SummaryConstructors Constructor Description ProtonStreamDecoderState(ProtonStreamDecoder decoder)Create a newStreamDecoderStateinstance that is joined forever to the givenDecoder.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringdecodeUTF8(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.ProtonStreamDecodergetDecoder()UTF8StreamDecodergetStringDecoder()ProtonStreamDecoderStatereset()Resets any intermediate state back to default values.voidsetStringDecoder(UTF8StreamDecoder stringDecoder)Sets a custom UTF-8Stringdecoder that will be used for allStringdecoding done from the encoder associated with thisStreamDecoderStateinstance.
 
- 
- 
- 
Constructor Detail- 
ProtonStreamDecoderStatepublic ProtonStreamDecoderState(ProtonStreamDecoder decoder) Create a newStreamDecoderStateinstance that is joined forever to the givenDecoder.- Parameters:
- decoder- The- StreamDecoderthat this state instance is assigned to.
 
 
- 
 - 
Method Detail- 
getDecoderpublic ProtonStreamDecoder getDecoder() - Specified by:
- getDecoderin interface- StreamDecoderState
- Returns:
- the StreamDecoderthat created this state object
 
 - 
resetpublic ProtonStreamDecoderState reset() Description copied from interface:StreamDecoderStateResets any intermediate state back to default values.- Specified by:
- resetin interface- StreamDecoderState
- Returns:
- this StreamDecoderStateinstance.
 
 - 
getStringDecoderpublic UTF8StreamDecoder getStringDecoder() - Returns:
- the currently set custom UTF-8 Stringdecoder or null if non set.
 
 - 
setStringDecoderpublic void setStringDecoder(UTF8StreamDecoder stringDecoder) Sets a custom UTF-8Stringdecoder that will be used for allStringdecoding done from the encoder associated with thisStreamDecoderStateinstance. If no decoder is registered then the implementation uses its own decoding algorithm.- Parameters:
- stringDecoder- a custom- UTF8Decoderthat will be used for all- Stringdecoding.
 
 - 
decodeUTF8public String decodeUTF8(InputStream stream, int length) throws DecodeException Description copied from interface:StreamDecoderStateGiven a stream that will provide UTF-8 encoded bytes, decode and return the String that represents that UTF-8 value.- Specified by:
- decodeUTF8in interface- StreamDecoderState
- Parameters:
- stream- A stream from which the UTF-8 encoded bytes are to be decoded.
- length- The number of bytes in the passed- InputStreamthat 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.
 
 
- 
 
-