Sha256: dc011872e2981f43ca2c609a8397d4cd310a459356e7f4423f1d5da5700afa38
Contents?: true
Size: 772 Bytes
Versions: 4
Compression:
Stored size: 772 Bytes
Contents
module HTTP2 # Simple binary buffer backed by string. # class Buffer < String UINT32 = 'N'.freeze private_constant :UINT32 # Forces binary encoding on the string def initialize(*) super.force_encoding(Encoding::BINARY) end # Emulate StringIO#read: slice first n bytes from the buffer. # # @param n [Integer] number of bytes to slice from the buffer def read(n) Buffer.new(slice!(0, n)) end # Alias getbyte to readbyte alias_method :readbyte, :getbyte # Emulate StringIO#getbyte: slice first byte from buffer. def getbyte read(1).ord end # Slice unsigned 32-bit integer from buffer. # @return [Integer] def read_uint32 read(4).unpack(UINT32).first end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
mieps_http-2-0.8.2 | lib/http/2/buffer.rb |
mieps_http-2-0.8.1 | lib/http/2/buffer.rb |
mieps_http-2-0.8.0 | lib/http/2/buffer.rb |
http-2-0.8.0 | lib/http/2/buffer.rb |