Package org.apache.qpid.protonj2.codec
Interface StreamDecoder
- All Known Implementing Classes:
- ProtonStreamDecoder
public interface StreamDecoder
Decode AMQP types from a 
InputStream instance.  When reading from an input stream
 care should be take to capture the stream position and state and reset if not enough bytes
 are available for the decoder to complete reading an encoded type as the decoder is not
 required to handle partially available type encodings.- 
Method SummaryModifier and TypeMethodDescriptionReturn a singletonStreamDecoderStateinstance that is meant to be shared within single threaded decoder interactions.Creates a newStreamDecoderStateinstance that can be used when interacting with the Decoder.peekNextTypeDecoder(InputStream stream, StreamDecoderState state) Peeks ahead in the givenInputStreaminstance and returns aTypeDecoderthat can read the next encoded AMQP type from the stream's bytes.readBinary(InputStream stream, StreamDecoderState state) Reads an encodedBinaryvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readBinaryAsBuffer(InputStream stream, StreamDecoderState state) Reads an encodedBinaryvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readBoolean(InputStream stream, StreamDecoderState state) Reads an encodedBooleanvalue from the givenInputStreamassuming that the next value in the byte stream is that type.booleanreadBoolean(InputStream stream, StreamDecoderState state, boolean defaultValue) Reads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type.readByte(InputStream stream, StreamDecoderState state) Reads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type.bytereadByte(InputStream stream, StreamDecoderState state, byte defaultValue) Reads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type.readCharacter(InputStream stream, StreamDecoderState state) Reads an encodedCharactervalue from the givenInputStreamassuming that the next value in the byte stream is that type.charreadCharacter(InputStream stream, StreamDecoderState state, char defaultValue) Reads an encodedCharactervalue from the givenInputStreamassuming that the next value in the byte stream is that type.readDecimal128(InputStream stream, StreamDecoderState state) Reads an encodedDecimal128value from the givenInputStreamassuming that the next value in the byte stream is that type.readDecimal32(InputStream stream, StreamDecoderState state) Reads an encodedDecimal32value from the givenInputStreamassuming that the next value in the byte stream is that type.readDecimal64(InputStream stream, StreamDecoderState state) Reads an encodedDecimal64value from the givenInputStreamassuming that the next value in the byte stream is that type.readDeliveryTag(InputStream stream, StreamDecoderState state) This method expects to read aBinaryencoded type from the provided stream and constructs aDeliveryTagtype that wraps the bytes encoded.readDouble(InputStream stream, StreamDecoderState state) Reads an encodedDoublevalue from the givenInputStreamassuming that the next value in the byte stream is that type.doublereadDouble(InputStream stream, StreamDecoderState state, double defaultValue) Reads an encodedDoublevalue from the givenInputStreamassuming that the next value in the byte stream is that type.readFloat(InputStream stream, StreamDecoderState state) Reads an encodedFloatvalue from the givenInputStreamassuming that the next value in the byte stream is that type.floatreadFloat(InputStream stream, StreamDecoderState state, float defaultValue) Reads an encodedFloatvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readInteger(InputStream stream, StreamDecoderState state) Reads an encodedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type.intreadInteger(InputStream stream, StreamDecoderState state, int defaultValue) Reads an encodedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type.<V> List<V>readList(InputStream stream, StreamDecoderState state) Reads an encodedListvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readLong(InputStream stream, StreamDecoderState state) Reads an encodedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type.longreadLong(InputStream stream, StreamDecoderState state, long defaultValue) Reads an encodedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type.<K,V> Map<K, V> readMap(InputStream stream, StreamDecoderState state) Reads an encodedMapvalue from the givenInputStreamassuming that the next value in the byte stream is that type.<T> T[]readMultiple(InputStream stream, StreamDecoderState state, Class<T> clazz) Reads one or more encoded values from the givenInputStreaman return it as an array ofObjectinstances which the caller must then interpret.readNextTypeDecoder(InputStream stream, StreamDecoderState state) Reads from the givenInputStreaminstance and returns aStreamTypeDecoderthat can read the next encoded AMQP type from the stream's bytes.readObject(InputStream stream, StreamDecoderState state) Reads an encoded value from the givenInputStreaman return it as anObjectwhich the caller must then interpret.<T> TreadObject(InputStream stream, StreamDecoderState state, Class<T> clazz) Reads an encoded value from the givenInputStreaman return it as anObjectwhich the caller must then interpret.readShort(InputStream stream, StreamDecoderState state) Reads an encodedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type.shortreadShort(InputStream stream, StreamDecoderState state, short defaultValue) Reads an encodedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readString(InputStream stream, StreamDecoderState state) Reads an encodedStringvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readSymbol(InputStream stream, StreamDecoderState state) Reads an encodedSymbolvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readSymbol(InputStream stream, StreamDecoderState state, String defaultValue) Reads an encodedStringvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readTimestamp(InputStream stream, StreamDecoderState state) Reads an encoded AMQP time stamp value from the givenInputStreamassuming that the next value in the byte stream is that type.longreadTimestamp(InputStream stream, StreamDecoderState state, long defaultValue) Reads an encoded AMQP time stamp value from the givenInputStreamassuming that the next value in the byte stream is that type.readUnsignedByte(InputStream stream, StreamDecoderState state) Reads an encodedUnsignedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type.bytereadUnsignedByte(InputStream stream, StreamDecoderState state, byte defaultValue) Reads an encodedUnsignedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type.readUnsignedInteger(InputStream stream, StreamDecoderState state) Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type.intreadUnsignedInteger(InputStream stream, StreamDecoderState state, int defaultValue) Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type.longreadUnsignedInteger(InputStream stream, StreamDecoderState state, long defaultValue) Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type.readUnsignedLong(InputStream stream, StreamDecoderState state) Reads an encodedUnsignedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type.longreadUnsignedLong(InputStream stream, StreamDecoderState state, long defaultValue) Reads an encodedUnsignedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readUnsignedShort(InputStream stream, StreamDecoderState state) Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type.intreadUnsignedShort(InputStream stream, StreamDecoderState state, int defaultValue) Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type.shortreadUnsignedShort(InputStream stream, StreamDecoderState state, short defaultValue) Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type.readUUID(InputStream stream, StreamDecoderState state) Reads an encodedUUIDvalue from the givenInputStreamassuming that the next value in the byte stream is that type.<V> StreamDecoderAllows customStreamDescribedTypeDecoderinstances to be registered with thisStreamDecoderwhich will be used if the described type encoding is encountered during decode operations.
- 
Method Details- 
newDecoderStateStreamDecoderState newDecoderState()Creates a newStreamDecoderStateinstance that can be used when interacting with the Decoder. For decoding that occurs on more than one thread while sharing a singleStreamDecoderinstance a different state object per thread is required as theStreamDecoderStateobject can retain some state information during the decode process that could be corrupted if more than one thread were to share a single instance. For single threaded decoding work theStreamDecoderoffers a utility cachedStreamDecoderStateAPI that will return the same instance on each call which can reduce allocation overhead and make using theStreamDecodersimpler.- Returns:
- a newly constructed EncoderStateinstance.
 
- 
getCachedDecoderStateStreamDecoderState getCachedDecoderState()Return a singletonStreamDecoderStateinstance that is meant to be shared within single threaded decoder interactions. If more than one thread makes use of this cachedStreamDecoderStatethe results of any decoding done using this state object is not guaranteed to be correct. The returned instance will have its reset method called to ensure that any previously stored state data is cleared before the next use.- Returns:
- a cached StreamDecoderStatelinked to this Decoder instance that has been reset.
 
- 
readBooleanReads an encodedBooleanvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readBooleanboolean readBoolean(InputStream stream, StreamDecoderState state, boolean defaultValue) throws DecodeException Reads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readByteReads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readBytebyte readByte(InputStream stream, StreamDecoderState state, byte defaultValue) throws DecodeException Reads an encodedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedByteReads an encodedUnsignedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedBytebyte readUnsignedByte(InputStream stream, StreamDecoderState state, byte defaultValue) throws DecodeException Reads an encodedUnsignedBytevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readCharacterReads an encodedCharactervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readCharacterchar readCharacter(InputStream stream, StreamDecoderState state, char defaultValue) throws DecodeException Reads an encodedCharactervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDecimal32Reads an encodedDecimal32value from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDecimal64Reads an encodedDecimal64value from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDecimal128Reads an encodedDecimal128value from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readShortReads an encodedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readShortshort readShort(InputStream stream, StreamDecoderState state, short defaultValue) throws DecodeException Reads an encodedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedShortUnsignedShort readUnsignedShort(InputStream stream, StreamDecoderState state) throws DecodeException Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedShortshort readUnsignedShort(InputStream stream, StreamDecoderState state, short defaultValue) throws DecodeException Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedShortint readUnsignedShort(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException Reads an encodedUnsignedShortvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readIntegerReads an encodedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readIntegerint readInteger(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException Reads an encodedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedIntegerUnsignedInteger readUnsignedInteger(InputStream stream, StreamDecoderState state) throws DecodeException Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedIntegerint readUnsignedInteger(InputStream stream, StreamDecoderState state, int defaultValue) throws DecodeException Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedIntegerlong readUnsignedInteger(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException Reads an encodedUnsignedIntegervalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readLongReads an encodedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readLonglong readLong(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException Reads an encodedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedLongReads an encodedUnsignedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUnsignedLonglong readUnsignedLong(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException Reads an encodedUnsignedLongvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readFloatReads an encodedFloatvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readFloatfloat readFloat(InputStream stream, StreamDecoderState state, float defaultValue) throws DecodeException Reads an encodedFloatvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDoubleReads an encodedDoublevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDoubledouble readDouble(InputStream stream, StreamDecoderState state, double defaultValue) throws DecodeException Reads an encodedDoublevalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readBinaryReads an encodedBinaryvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.The resulting Binaryinstance will contain a read-only view of the decoded bytes and any calls to access the underlying buffer will return a read-onlyProtonBuffer.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readBinaryAsBufferProtonBuffer readBinaryAsBuffer(InputStream stream, StreamDecoderState state) throws DecodeException Reads an encodedBinaryvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.The resulting ProtonBufferinstance will be a read-only view of the read in bytes.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source and returned in a ProtonBuffer.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readDeliveryTagThis method expects to read aBinaryencoded type from the provided stream and constructs aDeliveryTagtype that wraps the bytes encoded. If the encoding is a NULL AMQP type then this method returnsnull.- Parameters:
- stream- The- InputStreamto read a Binary encoded value from
- state- The current encoding state.
- Returns:
- a new DeliveryTag instance or null if an AMQP NULL encoding is found.
- Throws:
- DecodeException- if an error occurs while decoding the- DeliveryTaginstance.
 
- 
readStringReads an encodedStringvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readSymbolReads an encodedSymbolvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readSymbolString readSymbol(InputStream stream, StreamDecoderState state, String defaultValue) throws DecodeException Reads an encodedStringvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readTimestampReads an encoded AMQP time stamp value from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source and return a Longwith the time value.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readTimestamplong readTimestamp(InputStream stream, StreamDecoderState state, long defaultValue) throws DecodeException Reads an encoded AMQP time stamp value from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- defaultValue- A default value to return if the next encoded value is a Null encoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readUUIDReads an encodedUUIDvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readObjectReads an encoded value from the givenInputStreaman return it as anObjectwhich the caller must then interpret.- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not able to be decoded.
 
- 
readObject<T> T readObject(InputStream stream, StreamDecoderState state, Class<T> clazz) throws DecodeException Reads an encoded value from the givenInputStreaman return it as anObjectwhich the caller must then interpret.- Type Parameters:
- T- the type that will be used when casting and returning the decoded value.
- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- clazz- The- Classtype that should be used to cast the returned value.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not able to be decoded.
 
- 
readMultiple<T> T[] readMultiple(InputStream stream, StreamDecoderState state, Class<T> clazz) throws DecodeException Reads one or more encoded values from the givenInputStreaman return it as an array ofObjectinstances which the caller must then interpret.- Type Parameters:
- T- the type that will be used when casting and returning the decoded value.
- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- clazz- The- Classtype that should be used to cast the returned array.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not able to be decoded.
 
- 
readMapReads an encodedMapvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Type Parameters:
- K- The key type for the map that is being read.
- V- The value type for the map that is being read.
- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readListReads an encodedListvalue from the givenInputStreamassuming that the next value in the byte stream is that type. The operation fails if the next encoded type is not what was expected. If the caller wishes to recover from failed decode attempt they should make a note of the current read position and reset the input to make a further read attempt.- Type Parameters:
- V- The value type for the list that is being read.
- Parameters:
- stream- The- InputStreamwhere the read operation takes place.
- state- The- DecoderStatethat the decoder can use when decoding.
- Returns:
- the value read from the provided byte source.
- Throws:
- DecodeException- if the value fails to decode is not of the expected type,
 
- 
readNextTypeDecoderStreamTypeDecoder<?> readNextTypeDecoder(InputStream stream, StreamDecoderState state) throws DecodeException Reads from the givenInputStreaminstance and returns aStreamTypeDecoderthat can read the next encoded AMQP type from the stream's bytes. If an error occurs attempting to read and determine the next type decoder anDecodeExceptionis thrown.- Parameters:
- stream- The stream to read from to determine the next- TypeDecoderneeded.
- state- The- DecoderStatevalue that can be used for intermediate decoding tasks.
- Returns:
- a StreamTypeDecoderinstance that can read the next type in the stream.
- Throws:
- DecodeException- if an error occurs while reading the next type decoder.
 
- 
peekNextTypeDecoderStreamTypeDecoder<?> peekNextTypeDecoder(InputStream stream, StreamDecoderState state) throws DecodeException Peeks ahead in the givenInputStreaminstance and returns aTypeDecoderthat can read the next encoded AMQP type from the stream's bytes. If an error occurs attempting to read and determine the next type decoder anDecodeExceptionis thrown. The underlying stream is not modified as a result of the peek operation and the returnedTypeDecoderwill fail to properly read the type until the encoding bytes are read. If the provided stream does not offer support for the mark API than this method can throw anUnsupportedOperationException.- Parameters:
- stream- The stream to read from to determine the next- TypeDecoderneeded.
- state- The- DecoderStatevalue that can be used for intermediate decoding tasks.
- Returns:
- a TypeDecoderinstance that can provide insight into the next type in the stream.
- Throws:
- DecodeException- if an error occurs while peeking ahead for the next type decoder.
 
- 
registerDescribedTypeDecoderAllows customStreamDescribedTypeDecoderinstances to be registered with thisStreamDecoderwhich will be used if the described type encoding is encountered during decode operations.- Type Parameters:
- V- The type that the decoder reads.
- Parameters:
- decoder- A- StreamDescribedTypeDecoderinstance to be registered with this- StreamDecoder
- Returns:
- this StreamDecoderinstance.
 
 
-