I'm seeing a situation where InStream.readBuf() is returning 0 instead of null when it has reached the end of the stream:
InStream.readBuf()
b := Buf(512) ins := "teststring".in v := ins.readBuf(b, 512) // v is 10 v = ins.readBuf(b, 512) // v is 0, not null
I would have expected v to be null in the second case.
I pushed a fix - it should return null when at end-of-stream.
Although just a warning, using byte oriented IO with Str.in only works for ASCII chars.
Str.in
Cool - thanks. The spot I ran into this is in a method that accepts a plain InStream as a param, so the Str specific behavior shouldn't be a concern.
InStream
Login or Signup to reply.
liamstask Sat 2 Jan 2010
I'm seeing a situation where
InStream.readBuf()
is returning 0 instead of null when it has reached the end of the stream:I would have expected v to be null in the second case.
brian Sun 3 Jan 2010
I pushed a fix - it should return null when at end-of-stream.
Although just a warning, using byte oriented IO with
Str.in
only works for ASCII chars.liamstask Sun 3 Jan 2010
Cool - thanks. The spot I ran into this is in a method that accepts a plain
InStream
as a param, so the Str specific behavior shouldn't be a concern.