public IRubyObject ungetbyte(ThreadContext context, IRubyObject b) {
OpenFile fptr = getOpenFileChecked();
boolean locked = fptr.lock();
try {
fptr.checkByteReadable(context);
if (b.isNil()) return context.nil;
if (b instanceof RubyFixnum) {
byte cc = (byte) RubyNumeric.fix2int(b);
b = RubyString.newStringNoCopy(context.runtime, new byte[]{cc});
} else {