Sha256: 57557cd3f77e915e290887a1ecdf86c5aba264a23e4b13f8a7141ef8c012e756
Contents?: true
Size: 900 Bytes
Versions: 3
Compression:
Stored size: 900 Bytes
Contents
# frozen_string_literal: true require 'forwardable' module Steam # Reads bytes from a given IO object. class ByteReader extend Forwardable # Create a ByteReader object # # @param io [:read] an io object def initialize(io) @io = io end # Reads a string of a given length from the stream # # @param len [Integer] the number of bytes to read # @return [String] The read string def string(len) read(len) end # Reads an unsigned 32 bit integer from the stream # # @return [Integer] The 32 bit integer def unsigned_int32 @io.read(4).unpack('<I*').first end # Reads an signed 32 bit integer from the stream # # @return [Integer] The 32 bit integer def signed_int32 @io.read(4).unpack('<i*').first end def_delegator :@io, :read, :read def_delegator :@io, :eof?, :eof? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
steamrb-0.1.3 | lib/steam/byte_reader.rb |
steamrb-0.1.2 | lib/steam/byte_reader.rb |
steamrb-0.1.1 | lib/steam/byte_reader.rb |