Module: BerkeleyLibrary::Util::StringIOs
- Extended by:
- StringIOs
- Defined in:
- lib/berkeley_library/util/stringios.rb
Instance Method Summary collapse
-
#getbyte(s, i) ⇒ Integer?
Returns the byte (not character) at the specified byte index in the specified
StringIO.
Instance Method Details
#getbyte(s, i) ⇒ Integer?
Returns the byte (not character) at the specified byte index
in the specified StringIO.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/berkeley_library/util/stringios.rb', line 16 def getbyte(s, i) return if i >= s.size return if s.size + i < 0 pos_orig = s.pos begin s.seek(i >= 0 ? i : s.size + i) s.getbyte ensure s.seek(pos_orig) end end |