From: Roger Pack Date: 2009-11-17T02:40:50+09:00 Subject: Re: Errno::ENOMEM reading a device in Ruby, not in Java thou > Interesting. > with 1.9, it will read all 64K at once (not with 1.8 though--it reads 4K > blocks until it reached 64K). > > sysread did work with 1.8, though As a followup gotcha (in case anybody runs into this). irb(main):001:0> a = File.open('/dev/nst2', 'rb') => # irb(main):002:0> a.eof? irb(main):005:0> a.sysread 64*1024 IOError: sysread for buffered IO from (irb):5:in `sysread' from (irb):5 meant "when you call eof? it actually converts the file descriptor internally into buffered mode, and read a byte from it to see if it reads zero bytes (implying EOF), thus you cannot call sysread after a buffered read call like eof?" -r -- Posted via http://www.ruby-forum.com/.