Class: Baykit::BayServer::Docker::Http::H1::Command::CmdContent

Inherits:
H1Command
  • Object
show all
Defined in:
lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf = nil, start = nil, len = nil) ⇒ CmdContent

Returns a new instance of CmdContent.



16
17
18
19
20
21
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 16

def initialize(buf = nil, start = nil, len = nil)
  super(H1Type::CONTENT)
  @buf = buf
  @start = start
  @len = len
end

Instance Attribute Details

#bufObject (readonly)

Returns the value of attribute buf.



12
13
14
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 12

def buf
  @buf
end

#lenObject (readonly)

Returns the value of attribute len.



14
15
16
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 14

def len
  @len
end

#startObject (readonly)

Returns the value of attribute start.



13
14
15
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 13

def start
  @start
end

Instance Method Details

#handle(cmd_handler) ⇒ Object



34
35
36
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 34

def handle(cmd_handler)
  return cmd_handler.handle_content(self)
end

#pack(pkt) ⇒ Object



29
30
31
32
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 29

def pack(pkt)
  acc = pkt.new_data_accessor
  acc.put_bytes(@buf, @start, @len)
end

#unpack(pkt) ⇒ Object



23
24
25
26
27
# File 'lib/baykit/bayserver/docker/http/h1/command/cmd_content.rb', line 23

def unpack(pkt)
  @buf = pkt.buf
  @start = pkt.header_len
  @len = pkt.data_len()
end