Class: Aws::Binary::EventStreamDecoder Private
- Inherits:
-
Object
- Object
- Aws::Binary::EventStreamDecoder
- Defined in:
- lib/aws-sdk-core/binary/event_stream_decoder.rb
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.
Instance Attribute Summary collapse
-
#events ⇒ Array
readonly
private
Events Array of arrived event objects.
Instance Method Summary collapse
-
#initialize(protocol, rules, output_ref, error_refs, io, event_stream_handler = nil) ⇒ EventStreamDecoder
constructor
private
that registered with callbacks for processing events when they arrive.
- #write(chunk) ⇒ Object private
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
16 17 18 19 20 21 22 |
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 16 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
#events ⇒ Array (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.
25 26 27 |
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 25 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.
27 28 29 30 31 32 33 34 35 |
# File 'lib/aws-sdk-core/binary/event_stream_decoder.rb', line 27 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 |