Module: HTTP2::BufferUtils
- Included in:
- Connection, FrameBuffer, Framer, Header::Compressor, Header::Decompressor, Header::Huffman
- Defined in:
- lib/http/2/extensions.rb,
sig/extensions.rbs
Instance Method Summary collapse
- #append_str(str, data) ⇒ void
- #read_str(str, n) ⇒ String
- #read_uint32(str) ⇒ Integer
- #shift_byte ⇒ Integer
Instance Method Details
#append_str(str, data) ⇒ void
This method returns an undefined value.
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) ⇒ String
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/http/2/extensions.rb', line 26 def read_str(str, n) return "".b if n == 0 enc = str.encoding if enc != Encoding::BINARY str = str.dup if str.frozen? str.force_encoding(Encoding::BINARY) end chunk = str.byteslice(0, n) str.bytesplice(0, chunk.length, "") chunk.force_encoding(Encoding::BINARY) end |
#read_uint32(str) ⇒ Integer
51 52 53 |
# File 'lib/http/2/extensions.rb', line 51 def read_uint32(str) read_str(str, 4).unpack1("N") end |
#shift_byte ⇒ Integer
9 |
# File 'sig/extensions.rbs', line 9
def shift_byte: (String str) -> Integer
|