*/
@JRubyMethod(name = "ungetc", required = 1)
public IRubyObject ungetc(IRubyObject number) {
int ch = RubyNumeric.fix2int(number);
OpenFile myOpenFile = getOpenFileChecked();
if (!myOpenFile.isReadBuffered()) {
throw getRuntime().newIOError("unread stream");
}
try {
myOpenFile.checkReadable(getRuntime());
myOpenFile.setReadBuffered();
if (myOpenFile.getMainStream().ungetc(ch) == -1 && ch != -1) {
throw getRuntime().newIOError("ungetc failed");
}
} catch (PipeException ex) {
throw getRuntime().newErrnoEPIPEError();
} catch (InvalidValueException ex) {