Ruby 1.9.0 リファレンスマニュアル > ライブラリ一覧 > library _builtin > class IO > getbyte
getbyte -> Integer | nil
IO から1バイトを読み込み整数として返します。 既に EOF に達していれば nil を返します。
f = File.new("testfile") f.getbyte #=> 84 f.getbyte #=> 104