Class ProtonStreamDecoder

  • All Implemented Interfaces:
    StreamDecoder

    public final class ProtonStreamDecoder
    extends Object
    implements StreamDecoder
    The default AMQP Decoder implementation.
    • Constructor Detail

      • ProtonStreamDecoder

        public ProtonStreamDecoder()
    • Method Detail

      • newDecoderState

        public ProtonStreamDecoderState newDecoderState()
        Description copied from interface: StreamDecoder
        Creates a new StreamDecoderState instance that can be used when interacting with the Decoder. For decoding that occurs on more than one thread while sharing a single StreamDecoder instance a different state object per thread is required as the StreamDecoderState object 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 the StreamDecoder offers a utility cached StreamDecoderState API that will return the same instance on each call which can reduce allocation overhead and make using the StreamDecoder simpler.
        Specified by:
        newDecoderState in interface StreamDecoder
        Returns:
        a newly constructed EncoderState instance.
      • getCachedDecoderState

        public ProtonStreamDecoderState getCachedDecoderState()
        Description copied from interface: StreamDecoder
        Return a singleton StreamDecoderState instance that is meant to be shared within single threaded decoder interactions. If more than one thread makes use of this cached StreamDecoderState the 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.
        Specified by:
        getCachedDecoderState in interface StreamDecoder
        Returns:
        a cached StreamDecoderState linked to this Decoder instance that has been reset.
      • readObject

        public <T> T readObject​(InputStream stream,
                                StreamDecoderState state,
                                Class<T> clazz)
                         throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded value from the given InputStream an return it as an Object which the caller must then interpret.
        Specified by:
        readObject in interface StreamDecoder
        Type Parameters:
        T - the type that will be used when casting and returning the decoded value.
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that the decoder can use when decoding.
        clazz - The Class type 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

        public <T> T[] readMultiple​(InputStream stream,
                                    StreamDecoderState state,
                                    Class<T> clazz)
                             throws DecodeException
        Description copied from interface: StreamDecoder
        Reads one or more encoded values from the given InputStream an return it as an array of Object instances which the caller must then interpret.
        Specified by:
        readMultiple in interface StreamDecoder
        Type Parameters:
        T - the type that will be used when casting and returning the decoded value.
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that the decoder can use when decoding.
        clazz - The Class type 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.
      • readBoolean

        public Boolean readBoolean​(InputStream stream,
                                   StreamDecoderState state)
                            throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Boolean value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readBoolean in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readBoolean

        public boolean readBoolean​(InputStream stream,
                                   StreamDecoderState state,
                                   boolean defaultValue)
                            throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Byte value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readBoolean in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readByte

        public Byte readByte​(InputStream stream,
                             StreamDecoderState state)
                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Byte value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readByte in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readByte

        public byte readByte​(InputStream stream,
                             StreamDecoderState state,
                             byte defaultValue)
                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Byte value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readByte in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedByte

        public UnsignedByte readUnsignedByte​(InputStream stream,
                                             StreamDecoderState state)
                                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedByte value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedByte in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedByte

        public byte readUnsignedByte​(InputStream stream,
                                     StreamDecoderState state,
                                     byte defaultValue)
                              throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedByte value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedByte in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readCharacter

        public Character readCharacter​(InputStream stream,
                                       StreamDecoderState state)
                                throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Character value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readCharacter in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readCharacter

        public char readCharacter​(InputStream stream,
                                  StreamDecoderState state,
                                  char defaultValue)
                           throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Character value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readCharacter in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readDecimal32

        public Decimal32 readDecimal32​(InputStream stream,
                                       StreamDecoderState state)
                                throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Decimal32 value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readDecimal32 in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readDecimal64

        public Decimal64 readDecimal64​(InputStream stream,
                                       StreamDecoderState state)
                                throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Decimal64 value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readDecimal64 in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readDecimal128

        public Decimal128 readDecimal128​(InputStream stream,
                                         StreamDecoderState state)
                                  throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Decimal128 value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readDecimal128 in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readShort

        public Short readShort​(InputStream stream,
                               StreamDecoderState state)
                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Short value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readShort in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readShort

        public short readShort​(InputStream stream,
                               StreamDecoderState state,
                               short defaultValue)
                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Short value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readShort in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedShort

        public UnsignedShort readUnsignedShort​(InputStream stream,
                                               StreamDecoderState state)
                                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedShort value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedShort in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedShort

        public short readUnsignedShort​(InputStream stream,
                                       StreamDecoderState state,
                                       short defaultValue)
                                throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedShort value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedShort in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedShort

        public int readUnsignedShort​(InputStream stream,
                                     StreamDecoderState state,
                                     int defaultValue)
                              throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedShort value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedShort in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readInteger

        public Integer readInteger​(InputStream stream,
                                   StreamDecoderState state)
                            throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Integer value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readInteger in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readInteger

        public int readInteger​(InputStream stream,
                               StreamDecoderState state,
                               int defaultValue)
                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Integer value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readInteger in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedInteger

        public UnsignedInteger readUnsignedInteger​(InputStream stream,
                                                   StreamDecoderState state)
                                            throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedInteger value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedInteger in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedInteger

        public int readUnsignedInteger​(InputStream stream,
                                       StreamDecoderState state,
                                       int defaultValue)
                                throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedInteger value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedInteger in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedInteger

        public long readUnsignedInteger​(InputStream stream,
                                        StreamDecoderState state,
                                        long defaultValue)
                                 throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedInteger value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedInteger in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readLong

        public Long readLong​(InputStream stream,
                             StreamDecoderState state)
                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Long value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readLong in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readLong

        public long readLong​(InputStream stream,
                             StreamDecoderState state,
                             long defaultValue)
                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Long value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readLong in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedLong

        public UnsignedLong readUnsignedLong​(InputStream stream,
                                             StreamDecoderState state)
                                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedLong value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedLong in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUnsignedLong

        public long readUnsignedLong​(InputStream stream,
                                     StreamDecoderState state,
                                     long defaultValue)
                              throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UnsignedLong value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUnsignedLong in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readFloat

        public Float readFloat​(InputStream stream,
                               StreamDecoderState state)
                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Float value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readFloat in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readFloat

        public float readFloat​(InputStream stream,
                               StreamDecoderState state,
                               float defaultValue)
                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Float value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readFloat in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readDouble

        public Double readDouble​(InputStream stream,
                                 StreamDecoderState state)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Double value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readDouble in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readDouble

        public double readDouble​(InputStream stream,
                                 StreamDecoderState state,
                                 double defaultValue)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Double value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readDouble in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readBinary

        public Binary readBinary​(InputStream stream,
                                 StreamDecoderState state)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Binary value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readBinary in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readBinaryAsBuffer

        public ProtonBuffer readBinaryAsBuffer​(InputStream stream,
                                               StreamDecoderState state)
                                        throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Binary value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readBinaryAsBuffer in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readString

        public String readString​(InputStream stream,
                                 StreamDecoderState state)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded String value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readString in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readSymbol

        public Symbol readSymbol​(InputStream stream,
                                 StreamDecoderState state)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Symbol value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readSymbol in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readSymbol

        public String readSymbol​(InputStream stream,
                                 StreamDecoderState state,
                                 String defaultValue)
                          throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded String value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readSymbol in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readTimestamp

        public Long readTimestamp​(InputStream stream,
                                  StreamDecoderState state)
                           throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded AMQP time stamp value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readTimestamp in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that the decoder can use when decoding.
        Returns:
        the value read from the provided byte source and return a Long with the time value.
        Throws:
        DecodeException - if the value fails to decode is not of the expected type,
      • readTimestamp

        public long readTimestamp​(InputStream stream,
                                  StreamDecoderState state,
                                  long defaultValue)
                           throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded AMQP time stamp value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readTimestamp in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readUUID

        public UUID readUUID​(InputStream stream,
                             StreamDecoderState state)
                      throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded UUID value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readUUID in interface StreamDecoder
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readMap

        public <K,​V> Map<K,​V> readMap​(InputStream stream,
                                                  StreamDecoderState state)
                                           throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded Map value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readMap in interface StreamDecoder
        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 InputStream where the read operation takes place.
        state - The DecoderState that 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,
      • readList

        public <V> List<V> readList​(InputStream stream,
                                    StreamDecoderState state)
                             throws DecodeException
        Description copied from interface: StreamDecoder
        Reads an encoded List value from the given InputStream assuming 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 mark the and reset the input to make a further read attempt.
        Specified by:
        readList in interface StreamDecoder
        Type Parameters:
        V - The value type for the list that is being read.
        Parameters:
        stream - The InputStream where the read operation takes place.
        state - The DecoderState that 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,