Module: HTTP2::BufferUtils

Included in:
Connection, FrameBuffer, Framer, Header::Compressor, Header::Decompressor, Header::Huffman
Defined in:
lib/http/2/extensions.rb

Instance Method Summary collapse

Instance Method Details

#append_str(str, data) ⇒ Object



6
7
8
# File 'lib/http/2/extensions.rb', line 6

def append_str(str, data)
  str.append_as_bytes(data)
end

#read_str(str, n) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/http/2/extensions.rb', line 26

def read_str(str, n)
  return "".b if n == 0

  chunk = str.byteslice(0, n)
  str.bytesplice(0, chunk.length, "")
  chunk
end

#read_uint32(str) ⇒ Object



44
45
46
# File 'lib/http/2/extensions.rb', line 44

def read_uint32(str)
  read_str(str, 4).unpack1("N")
end