Package jnr.posix

Examples of jnr.posix.FileStat


    }

    @JRubyMethod(name = "grpowned?", required = 1, module = true)
    public static IRubyObject grpowned_p(IRubyObject recv, IRubyObject filename) {
        Ruby runtime = recv.getRuntime();
        FileStat stat = fileResource(filename).stat();

        // JRUBY-4446, grpowned? always returns false on Windows
        if (Platform.IS_WINDOWS) return runtime.getFalse();
       
        return runtime.newBoolean(stat != null && stat.isGroupOwned());
    }
View Full Code Here


            } else {
                return runtime.getFalse();
            }
        }

        FileStat stat1 = file1.stat();
        FileStat stat2 = file2.stat();

        return runtime.newBoolean(stat1 != null && stat2 != null && stat1.isIdentical(stat2));
    }
View Full Code Here

        return runtime.newBoolean(stat1 != null && stat2 != null && stat1.isIdentical(stat2));
    }

    @JRubyMethod(name = "owned?", required = 1, module = true)
    public static IRubyObject owned_p(IRubyObject recv, IRubyObject filename) {
        FileStat stat = fileResource(filename).stat();

        return recv.getRuntime().newBoolean(stat != null && stat.isOwned());
    }
View Full Code Here

        return recv.getRuntime().newBoolean(stat != null && stat.isOwned());
    }

    @JRubyMethod(name = "pipe?", required = 1, module = true)
    public static IRubyObject pipe_p(IRubyObject recv, IRubyObject filename) {
        FileStat stat = fileResource(filename).stat();

        return recv.getRuntime().newBoolean(stat != null && stat.isNamedPipe());
    }
View Full Code Here

        Ruby runtime = context.runtime;
        if (!(filename instanceof RubyFile)) {
            filename = get_path(context, filename);
        }

        FileStat stat = fileResource(filename).stat();
        return runtime.newBoolean(stat != null && stat.isReadable());
    }
View Full Code Here

        return runtime.newBoolean(stat != null && stat.isReadable());
    }

    // Not exposed by filetest, but so similiar in nature that it is stored here
    public static IRubyObject rowned_p(IRubyObject recv, IRubyObject filename) {
        FileStat stat = fileResource(filename).stat();

        return recv.getRuntime().newBoolean(stat != null && stat.isROwned());
    }
View Full Code Here

        return recv.getRuntime().newBoolean(stat != null && stat.isROwned());
    }

    @JRubyMethod(name = "setgid?", required = 1, module = true)
    public static IRubyObject setgid_p(IRubyObject recv, IRubyObject filename) {
        FileStat stat = fileResource(filename).stat();

        return recv.getRuntime().newBoolean(stat != null && stat.isSetgid());
    }
View Full Code Here

        return recv.getRuntime().newBoolean(stat != null && stat.isSetgid());
    }

    @JRubyMethod(name = "setuid?", required = 1, module = true)
    public static IRubyObject setuid_p(IRubyObject recv, IRubyObject filename) {
        FileStat stat = fileResource(filename).stat();

        return recv.getRuntime().newBoolean(stat != null && stat.isSetuid());
    }
View Full Code Here

    public static IRubyObject size(ThreadContext context, IRubyObject recv, IRubyObject filename) {
        if (!(filename instanceof RubyFile) && filename.respondsTo("to_io")) {
             filename = TypeConverter.convertToType(filename, context.runtime.getIO(), "to_io");
        }

        FileStat stat = fileResource(filename).stat();

        if (stat == null) noFileError(filename);

        return context.runtime.newFixnum(stat.st_size());
    }
View Full Code Here

        Ruby runtime = context.runtime;
        if (!(filename instanceof RubyFile) && filename.respondsTo("to_io")) {
            filename = TypeConverter.convertToType(filename, runtime.getIO(), "to_io");
        }

        FileStat stat = fileResource(filename).stat();

        if (stat == null) return runtime.getNil();

        long length = stat.st_size();
        return length > 0 ? runtime.newFixnum(length) : runtime.getNil();
    }
View Full Code Here

TOP

Related Classes of jnr.posix.FileStat

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.