Package org.jruby.util.io

Examples of org.jruby.util.io.ModeFlags


                mode = RubyFixnum.num2int(args[1]);
            } else {
                mode = getIOModesIntFromString(runtime, args[1].convertToString().toString());
            }

            ModeFlags modes = new ModeFlags(mode);

            ShellLauncher.POpenProcess process = ShellLauncher.popen(runtime, cmdObj, modes);

            // Yes, this is gross. java.lang.Process does not appear to be guaranteed
            // "ready" when we get it back from Runtime#exec, so we try to give it a
View Full Code Here


                mode = RubyFixnum.num2int(args[1]);
            } else {
                mode = getIOModesIntFromString(runtime, args[1].convertToString().toString());
            }

            ModeFlags modes = new ModeFlags(mode);

            ShellLauncher.POpenProcess process;
            if (r19Popen.cmdPlusArgs == null) {
                process = ShellLauncher.popen(runtime, r19Popen.cmd, modes);
            } else {
View Full Code Here

        return dir;
    }

    private void initializeOpen() {
        try {
            ModeFlags modeFlags = new ModeFlags(ModeFlags.RDWR | ModeFlags.EXCL);
            getRuntime().getPosix().chmod(path, 0600);
            sysopenInternal(path, modeFlags, 0600);
        } catch (InvalidValueException e) {
            throw getRuntime().newErrnoEINVALError();
        }
View Full Code Here

                channel = SocketChannel.open();
            } else if(soType == Sock.SOCK_DGRAM.value()) {
                channel = DatagramChannel.open();
            }

            initSocket(context.getRuntime(), new ChannelDescriptor(channel, new ModeFlags(ModeFlags.RDWR)));
        } catch (InvalidValueException ex) {
            throw context.getRuntime().newErrnoEINVALError();
        } catch(IOException e) {
            throw sockerr(context.getRuntime(), "initialize: " + e.toString());
        }
View Full Code Here

            }

            socket_address = new InetSocketAddress(addr, portInt);
            ssc.socket().bind(socket_address);
            initSocket(context.getRuntime(), new ChannelDescriptor(
                    ssc, new ModeFlags(ModeFlags.RDWR)));
        } catch (InvalidValueException ex) {
            throw context.getRuntime().newErrnoEINVALError();
        } catch(UnknownHostException e) {
            throw sockerr(context.getRuntime(), "initialize: name or service not known");
        } catch(BindException e) {
View Full Code Here

                            connected.configureBlocking(false);
                            connected.configureBlocking(true);
                        }

                        // otherwise one key has been selected (ours) so we get the channel and hand it off
                        socket.initSocket(context.getRuntime(), new ChannelDescriptor(connected, new ModeFlags(ModeFlags.RDWR)));
                    } catch (InvalidValueException ex) {
                        throw context.getRuntime().newErrnoEINVALError();
                    }
                    return socket;
                }
View Full Code Here

                    // no connection immediately accepted, let them try again
                    throw context.getRuntime().newErrnoEAGAINError("Resource temporarily unavailable");
                } else {
                    try {
                        // otherwise one key has been selected (ours) so we get the channel and hand it off
                        socket.initSocket(context.getRuntime(), new ChannelDescriptor(ssc.accept(), new ModeFlags(ModeFlags.RDWR)));
                    } catch (InvalidValueException ex) {
                        throw context.getRuntime().newErrnoEINVALError();
                    }
                    return socket;
                }
View Full Code Here

    protected void initSocket(Ruby runtime, ChannelDescriptor descriptor) {
        // continue with normal initialization
        openFile = new OpenFile();
       
        try {
            openFile.setMainStream(ChannelStream.fdopen(runtime, descriptor, new ModeFlags(ModeFlags.RDONLY)));
            openFile.setPipeStream(ChannelStream.fdopen(runtime, descriptor, new ModeFlags(ModeFlags.WRONLY)));
            openFile.getPipeStream().setSync(true);
        } catch (org.jruby.util.io.InvalidValueException ex) {
            throw runtime.newErrnoEINVALError();
        }
        openFile.setMode(OpenFile.READWRITE | OpenFile.SYNC);
View Full Code Here

    }

    private void initializeModes(Object modeArgument) {
        try {
            if (modeArgument == null) {
                data.modes = new ModeFlags(RubyIO.getIOModesIntFromString(getRuntime(), "r+"));
            } else if (modeArgument instanceof Long) {
                data.modes = new ModeFlags(((Long)modeArgument).longValue());
            } else {
                data.modes = new ModeFlags(RubyIO.getIOModesIntFromString(getRuntime(), (String) modeArgument));
            }
        } catch (InvalidValueException e) {
            throw getRuntime().newErrnoEINVALError();
        }
        setupModes();
View Full Code Here

        runtime.checkSafeString(filename);

        path = adjustRootPathOnWindows(runtime, filename.getUnicodeValue(), runtime.getCurrentDirectory());

        String modeString = "r";
        ModeFlags modes = new ModeFlags();
        int perm = 0;

        try {
            if (args.length > 1) {
                if (args[1] instanceof RubyHash) {
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.