Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Supporting IO.ungetbyte #697

merged 1 commit into from

2 participants


We can use ungetc to support ungetbyte, that will left only 1 spec failing which is an edge case. What happens is that when trying to push the number 4095, like the specs do on the ChanelStream class that int will be convert to a byte (-1) and inside jruby internals -1 is considered EOF, so for we to support this we would have to change a lot of things. The method willl work for every number but 4095 because of this case.

@headius headius merged commit 87605ef into jruby:master

1 check failed

Details default The Travis build could not complete due to an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 3, 2013
  1. @josedonizetti
This page is out of date. Refresh to see the latest.
4 spec/tags/1.9/ruby/core/io/ungetbyte_tags.txt
@@ -1,5 +1 @@
-fails:IO#ungetbyte does nothing when passed nil
-fails:IO#ungetbyte puts back each byte in a String argument
-fails:IO#ungetbyte calls #to_str to convert the argument
fails:IO#ungetbyte puts back one byte for an Integer argument
-fails:IO#ungetbyte raises an IOError if the IO is closed
2  src/org/jruby/
@@ -2618,7 +2618,7 @@ public IRubyObject ungetc(IRubyObject number) {
return getRuntime().getNil();
- @JRubyMethod(name = "ungetc", required = 1, compat = CompatVersion.RUBY1_9)
+ @JRubyMethod(name = {"ungetc", "ungetbyte"}, required = 1, compat = CompatVersion.RUBY1_9)
public IRubyObject ungetc19(IRubyObject character) {
Ruby runtime = getRuntime();
Something went wrong with that request. Please try again.