Class: Quicsilver::Transport::InboundStream
- Inherits:
-
Object
- Object
- Quicsilver::Transport::InboundStream
- Defined in:
- lib/quicsilver/transport/inbound_stream.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#is_unidirectional ⇒ Object
readonly
Returns the value of attribute is_unidirectional.
-
#stream_handle ⇒ Object
Returns the value of attribute stream_handle.
-
#stream_id ⇒ Object
readonly
Returns the value of attribute stream_id.
Instance Method Summary collapse
- #append_data(data) ⇒ Object
- #bidirectional? ⇒ Boolean
- #data ⇒ Object
-
#initialize(stream_id, is_unidirectional: nil) ⇒ InboundStream
constructor
A new instance of InboundStream.
- #writable? ⇒ Boolean
Constructor Details
#initialize(stream_id, is_unidirectional: nil) ⇒ InboundStream
Returns a new instance of InboundStream.
9 10 11 12 13 14 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 9 def initialize(stream_id, is_unidirectional: nil) @stream_id = stream_id @is_unidirectional = is_unidirectional.nil? ? !bidirectional? : is_unidirectional @buffer = StringIO.new.tap { |io| io.set_encoding(Encoding::ASCII_8BIT) } @stream_handle = nil end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
6 7 8 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 6 def buffer @buffer end |
#is_unidirectional ⇒ Object (readonly)
Returns the value of attribute is_unidirectional.
6 7 8 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 6 def is_unidirectional @is_unidirectional end |
#stream_handle ⇒ Object
Returns the value of attribute stream_handle.
7 8 9 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 7 def stream_handle @stream_handle end |
#stream_id ⇒ Object (readonly)
Returns the value of attribute stream_id.
6 7 8 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 6 def stream_id @stream_id end |
Instance Method Details
#append_data(data) ⇒ Object
24 25 26 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 24 def append_data(data) @buffer.write(data) end |
#bidirectional? ⇒ Boolean
16 17 18 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 16 def bidirectional? (stream_id & 0x02) == 0 end |
#data ⇒ Object
28 29 30 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 28 def data @buffer.string end |
#writable? ⇒ Boolean
20 21 22 |
# File 'lib/quicsilver/transport/inbound_stream.rb', line 20 def writable? !stream_handle.nil? end |