Struct: eventstream.Decoder

import "../ibm-cos-sdk-go-v2/aws/protocol/eventstream"

Overview

Decoder provides decoding of an Event Stream messages.

Implemented Interfaces

types.AnalyticsFilter, v4.HTTPPresigner, s3.HTTPPresignerV4, types.MetricsFilter, s3.PresignPost, arn.S3ObjectLambdaARN, types.SelectObjectContentEventStream

Method Summary collapse

Method Details

func (d *Decoder) Decode(reader io.Reader, payloadBuf []byte) (m Message, err error)

Decode attempts to decode a single message from the event stream reader. Will return the event stream message, or error if decodeMessage fails to read the message from the stream.

payloadBuf is a byte slice that will be used in the returned Message.Payload. Callers must ensure that the Message.Payload from a previous decode has been consumed before passing in the same underlying payloadBuf byte slice.



46
47
48
49
50
51
52
53
54
55
56
57
58
// File 'aws/protocol/eventstream/decode.go', line 46

func (d *Decoder) Decode(reader io.Reader, payloadBuf []byte) (m Message, err error) { if d.options.Logger != nil && d.options.LogMessages { debugMsgBuf := bytes.NewBuffer(nil) reader = io.TeeReader(reader, debugMsgBuf) defer func() { logMessageDecode(d.options.Logger, debugMsgBuf, m, err) }() } m, err = decodeMessage(reader, payloadBuf) return m, err }