Class: Aws::Binary::EventStreamDecoder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/binary/event_stream_decoder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(protocol, rules, output_ref, error_refs, io, event_stream_handler = nil) ⇒ EventStreamDecoder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

that registered with callbacks for processing events when they arrive

Parameters:

  • ShapeRef of the eventstream member

  • ShapeRef of output shape

  • array of ShapeRefs for errors

  • (defaults to: nil)

    A Service EventStream object

API:

  • private



14
15
16
17
18
19
20
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 14

def initialize(protocol, rules, output_ref, error_refs, io, event_stream_handler = nil)
  @decoder = Aws::EventStream::Decoder.new
  @event_parser = EventParser.new(parser_class(protocol), rules, error_refs, output_ref)
  @stream_class = extract_stream_class(rules.shape.struct_class)
  @emitter = event_stream_handler.event_emitter
  @events = []
end

Instance Attribute Details

#eventsArray (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns events Array of arrived event objects.

Returns:

  • events Array of arrived event objects

API:

  • private



23
24
25
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 23

def events
  @events
end

Instance Method Details

#write(chunk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



25
26
27
28
29
30
31
32
33
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 25

def write(chunk)
  raw_event, eof = @decoder.decode_chunk(chunk)
  emit_event(raw_event) if raw_event
  while !eof
    # exhaust message_buffer data
    raw_event, eof = @decoder.decode_chunk
    emit_event(raw_event) if raw_event
  end
end