Module: FastImageParsing::StreamUtil

Included in:
FiberStream, IOStream
Defined in:
lib/fastimage/fastimage_parsing/stream_util.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#read_byteObject



3
4
5
# File 'lib/fastimage/fastimage_parsing/stream_util.rb', line 3

def read_byte
  read(1)[0].ord
end

#read_intObject



7
8
9
# File 'lib/fastimage/fastimage_parsing/stream_util.rb', line 7

def read_int
  read(2).unpack('n')[0]
end

#read_string_intObject



11
12
13
14
15
16
17
# File 'lib/fastimage/fastimage_parsing/stream_util.rb', line 11

def read_string_int
  value = []
  while read(1) =~ /(\d)/
    value << $1
  end
  value.join.to_i
end