Examples of OpenFile


Examples of org.jruby.util.io.OpenFile

        if (str.getByteList().length() == 0) {
            return runtime.newFixnum(0);
        }

        try {
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkWritable(runtime);

            context.getThread().beforeBlockingCall();
            int written = fwrite(str.getByteList());

            if (written == -1) {
                // TODO: sys fail
            }

            // if not sync, we switch to write buffered mode
            if (!myOpenFile.isSync()) {
                myOpenFile.setWriteBuffered();
            }

            return runtime.newFixnum(written);
        } catch (IOException ex) {
            throw runtime.newIOErrorFromException(ex);
View Full Code Here

Examples of org.jruby.util.io.OpenFile

     *
     * @return the pid or nil
     */
    @JRubyMethod(name = "pid")
    public IRubyObject pid(ThreadContext context) {
        OpenFile myOpenFile = getOpenFileChecked();
       
        if (myOpenFile.getProcess() == null) {
            return context.getRuntime().getNil();
        }
       
        // Of course this isn't particularly useful.
        long pid = myOpenFile.getPid();
       
        return context.getRuntime().newFixnum(pid);
    }
View Full Code Here

Examples of org.jruby.util.io.OpenFile

        if (offset < 0) {
            throw context.getRuntime().newSystemCallError("Negative seek offset");
        }
       
        OpenFile myOpenFile = getOpenFileChecked();
       
        try {
            myOpenFile.getMainStreamSafe().lseek(offset, Stream.SEEK_SET);
       
            myOpenFile.getMainStreamSafe().clearerr();
        } catch (BadDescriptorException e) {
            throw context.getRuntime().newErrnoEBADFError();
        } catch (InvalidValueException e) {
            throw context.getRuntime().newErrnoEINVALError();
        } catch (PipeException e) {
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.