Package org.jruby.util.io

Examples of org.jruby.util.io.ModeFlags


        }
    }

    public static IOOptions newIOOptions(Ruby runtime, IOOptions oldFlags, int orOflags) {
        try {
            return new IOOptions(new ModeFlags(oldFlags.getModeFlags().getFlags() | orOflags));
        } catch (InvalidValueException ive) {
            throw runtime.newErrnoEINVALError();
        }
    }
View Full Code Here


    }

    public FileDescriptorIO(Ruby runtime, IRubyObject fd) {
        super(runtime, runtime.getModule("FFI").getClass(CLASS_NAME));
        MakeOpenFile();
        ModeFlags modes = newModeFlags(runtime, ModeFlags.RDWR);
        int fileno = RubyNumeric.fix2int(fd);
        FileStat stat = runtime.getPosix().fstat(fileno);
        ByteChannel channel;

        if (stat.isSocket()) {
            channel = new jnr.enxio.channels.NativeSocketChannel(fileno);
        } else if (stat.isBlockDev() || stat.isCharDev()) {
            channel = new jnr.enxio.channels.NativeDeviceChannel(fileno);
        } else {
            channel = new FileDescriptorByteChannel(runtime, fileno);
        }

//        openFile.setMainStream(ChannelStream.open(getRuntime(), new ChannelDescriptor(channel, modes, FileDescriptorHelper.wrap(fileno))));
        openFile.setChannel(channel);
        openFile.setMode(modes.getOpenFileFlags());
        openFile.setMode(modes.getOpenFileFlags());
        openFile.setSync(true);
    }
View Full Code Here

TOP

Related Classes of org.jruby.util.io.ModeFlags

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.