Sha256: 1998fe774fbf9c685d4969e5754891dd893f7396243472d0d094d766a3c09656
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true module CSstats module Parser module Reader class FileStreamer attr_reader :stream def initialize(stream) @stream = stream end # Internal: Get the 32bit integer from file. # # Returns the Integer. def read_int_data data = stream.read(4) raise CSstats::Error, 'Cannot read int data.' unless data data.unpack1('V') end # Internal: Get the 16bit integer from file. # # Returns the Integer. def read_short_data data = stream.read(2) raise CSstats::Error, 'Cannot read short data.' unless data data.unpack1('v') end # Internal: Get the String from file. # # length - The Integer length of string to read. # # Returns the String. def read_string_data(length) data = stream.read(length) raise CSstats::Error, 'Cannot read string data.' unless data data.strip end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csstats-1.3.0 | lib/csstats/parser/reader/file_streamer.rb |