lib/mikunyan/binary_reader.rb in mikunyan-3.9.9 vs lib/mikunyan/binary_reader.rb in mikunyan-3.9.10
- old
+ new
@@ -54,10 +54,11 @@
# @param [Integer] size size
# @return [String] data
def read(size)
ret = @io.read(size)
raise EOFError if ret.nil? || size && ret.bytesize < size
+
ret
end
# Reads given size of binary string from specified position. This method does not seek.
# @param [Integer] size size
@@ -73,9 +74,10 @@
# Reads string until null character
# @return [String] string
def cstr
raise EOFError if @io.eof?
+
@io.each_byte.take_while(&:nonzero?).pack('C*')
end
# Reads an 8bit bool value
def bool