File: stream_util.rb

package info (click to toggle)
ruby-fastimage 2.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,008 kB
  • sloc: ruby: 1,442; xml: 7; makefile: 2; sh: 1
file content (19 lines) | stat: -rw-r--r-- 302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module FastImageParsing
  module StreamUtil # :nodoc:
    def read_byte
      read(1)[0].ord
    end
  
    def read_int
      read(2).unpack('n')[0]
    end
  
    def read_string_int
      value = []
      while read(1) =~ /(\d)/
        value << $1
      end
      value.join.to_i
    end
  end
end