Class: Baykit::BayServer::Docker::Http::H2::Command::CmdData
- Inherits:
-
H2Command
- Object
- Protocol::Command
- H2Command
- Baykit::BayServer::Docker::Http::H2::Command::CmdData
- Includes:
- Baykit::BayServer::Docker::Http::H2
- Defined in:
- lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#start ⇒ Object
readonly
This class refers external byte array, so this IS NOT mutable.
Attributes inherited from H2Command
Instance Method Summary collapse
- #handle(cmd_handler) ⇒ Object
-
#initialize(stream_id, flags, data = nil, start = nil, len = nil) ⇒ CmdData
constructor
A new instance of CmdData.
- #pack(pkt) ⇒ Object
- #unpack(pkt) ⇒ Object
Constructor Details
#initialize(stream_id, flags, data = nil, start = nil, len = nil) ⇒ CmdData
Returns a new instance of CmdData.
31 32 33 34 35 36 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 31 def initialize(stream_id, flags, data=nil, start=nil, len=nil) super(H2Type::DATA, stream_id, flags) @data = data @start = start @length = len end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
29 30 31 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 29 def data @data end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
28 29 30 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 28 def length @length end |
#start ⇒ Object (readonly)
This class refers external byte array, so this IS NOT mutable
27 28 29 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 27 def start @start end |
Instance Method Details
#handle(cmd_handler) ⇒ Object
54 55 56 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 54 def handle(cmd_handler) return cmd_handler.handle_data(self) end |
#pack(pkt) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 45 def pack(pkt) acc = pkt.new_data_accessor() if @flags.padded? raise RuntimeError.new("Padding not supported") end acc.put_bytes(@data, @start, @length) super end |
#unpack(pkt) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/baykit/bayserver/docker/http/h2/command/cmd_data.rb', line 38 def unpack(pkt) super @data = pkt.buf @start = pkt.header_len @length = pkt.data_len() end |