class HTTP2::Buffer

Simple binary buffer backed by string.

Constants

UINT32

Public Class Methods

new(*) click to toggle source

Forces binary encoding on the string

Calls superclass method
# File lib/http/2/buffer.rb, line 9
def initialize(*)
  super.force_encoding(Encoding::BINARY)
end

Public Instance Methods

getbyte() click to toggle source

Emulate StringIO#getbyte: slice first byte from buffer.

# File lib/http/2/buffer.rb, line 24
def getbyte
  read(1).ord
end
Also aliased as: readbyte
read(n) click to toggle source

Emulate StringIO#read: slice first n bytes from the buffer.

@param n [Integer] number of bytes to slice from the buffer

# File lib/http/2/buffer.rb, line 16
def read(n)
  Buffer.new(slice!(0, n))
end
read_uint32() click to toggle source

Slice unsigned 32-bit integer from buffer. @return [Integer]

# File lib/http/2/buffer.rb, line 30
def read_uint32
  read(4).unpack(UINT32).first
end
readbyte()

Alias getbyte to readbyte

Alias for: getbyte