IO#each_byte
IO#each_byteで1バイトずつファイルを読むことができます。
FILENAME = "file" open(FILENAME, "w") do |f| f.puts "Hello!" f.puts "This is Rubyco." end File.open(FILENAME, "r") do |f| f.each_byte do |c| printf("%02X ", c) end end #=> 48 65 6C 6C 6F 21 0A 54 68 69 73 20 69 73 20 52 75 62 79 63 6F 2E 0A