Examples of ExecIt


Examples of jnr.posix.util.ExecIt

    public int chmod(String filename, int mode) {
        return Chmod.chmod(new JavaSecuredFile(filename), Integer.toOctalString(mode));
    }

    public int chown(String filename, int user, int group) {
        ExecIt launcher = new ExecIt(handler);
        int chownResult = -1;
        int chgrpResult = -1;
       
        try {
            if (user != -1) chownResult = launcher.runAndWait("chown", ""+user, filename);
            if (group != -1) chgrpResult = launcher.runAndWait("chgrp ", ""+user, filename);
        } catch (Exception e) {}
       
        return chownResult != -1 && chgrpResult != -1 ? 0 : 1;
    }
View Full Code Here

Examples of jnr.posix.util.ExecIt

        return (fd == STDOUT || fd == STDIN || fd == STDERR) ? 1 : 0;
    }

    public int link(String oldpath, String newpath) {
        try {
            return new ExecIt(handler).runAndWait("ln", oldpath, newpath);
        } catch (Exception e) {}

        return -1// We tried and failed for some reason. Indicate error.
    }
View Full Code Here

Examples of jnr.posix.util.ExecIt

        return 0;
    }

    public int symlink(String oldpath, String newpath) {
        try {
            return new ExecIt(handler).runAndWait("ln", "-s", oldpath, newpath);
        } catch (Exception e) {}
           
        return -1// We tried and failed for some reason. Indicate error.
    }
View Full Code Here

Examples of jnr.posix.util.ExecIt

    }

    public int readlink(String oldpath, ByteBuffer buffer, int length) throws IOException {
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            new ExecIt(handler).runAndWait(baos, "readlink", oldpath);
           
            byte[] bytes = baos.toByteArray();
           
            if (bytes.length > length || bytes.length == 0) return -1;
            buffer.put(bytes, 0, bytes.length - 1); // trim off \n
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.