io.MakeOpenFile();
Object pm = vmodeVperm(pmode, runtime.newFixnum(0));
int[] oflags_p = {0}, fmode_p = {0};
EncodingUtils.extractModeEncoding(context, io, pm, options, oflags_p, fmode_p);
ModeFlags modes = ModeFlags.createModeFlags(oflags_p[0]);
// FIXME: Reprocessing logic twice for now...
// for 1.9 mode, strip off the trailing options hash, if there
if (args.length > 1 && args[args.length - 1] instanceof RubyHash) {
options = (RubyHash)args[args.length - 1];