Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
IO#rewind ... doesn't. (when backed by a ByteArrayInputStream). #2381
From: http://jira.codehaus.org/browse/JRUBY-5891. Works in 1.7.18 and not on master.
See: https://gist.github.com/1043829 which includes a test case.
If you have a ByteArrayInputStream, then call #to_io on it, then you read from the stream and #rewind it, the offset into the stream doesn't change. I believe this is due to lseek dropping out the bottom of a conditional when it should perhaps throw an exception.
I am happy to provide a JUnit test and patch if folks agree with me that this is the wrong behavior. I just spent the better part of a day fixing broken behavior whose genesis was this issue.
seems to be working "correctly" on 22.214.171.124 :
... although I think with a little trick (by-passing