Class: Baykit::BayServer::Docker::Ajp::AjpPacket::AjpAccessor

Inherits:
Protocol::PacketPartAccessor
  • Object
show all
Includes:
Util
Defined in:
lib/baykit/bayserver/docker/ajp/ajp_packet.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, start, max_len) ⇒ AjpAccessor

Returns a new instance of AjpAccessor.



48
49
50
# File 'lib/baykit/bayserver/docker/ajp/ajp_packet.rb', line 48

def initialize(type, start, max_len)
  super
end

Instance Method Details

#get_stringObject



62
63
64
# File 'lib/baykit/bayserver/docker/ajp/ajp_packet.rb', line 62

def get_string
  get_string_by_len(get_short())
end

#get_string_by_len(len) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/baykit/bayserver/docker/ajp/ajp_packet.rb', line 66

def get_string_by_len(len)

  if len == 0xffff
    return ""
  end

  buf = StringUtil.alloc(len)
  get_bytes(buf, 0, len)
  get_byte() # null terminator

  buf
end

#put_string(str) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/baykit/bayserver/docker/ajp/ajp_packet.rb', line 52

def put_string(str)
  if StringUtil.empty?(str)
    put_short(0xffff)
  else
    put_short(str.length)
    super str
    put_byte(0) # null terminator
  end
end