Package org.jruby.util.io

Examples of org.jruby.util.io.OpenFile.unlock()


            //        #else
            //        ((void)off, (void)l);  /* Ignore all hint */
            return context.nil;
            //        #endif
        } finally {
            if (locked) fptr.unlock();
        }
    }

    // MRI: advice_arg_check
    static void adviceArgCheck(ThreadContext context, IRubyObject advice) {
View Full Code Here


                } else {
                    fptr.seek(context, pos + size, PosixShim.SEEK_SET);
                }
            }
        } finally {
            if (locked) fptr.unlock();
        }
    }

    private static long transfer(ThreadContext context, ReadableByteChannel from, FileChannel to, long length, long position) throws IOException {
        // handle large files on 32-bit JVMs
View Full Code Here

        fptr = io.getOpenFileChecked();
        fptr.lock();
        try {
            return (fptr.getMode() & OpenFile.SYNC) != 0 ? runtime.getTrue() : runtime.getFalse();
        } finally {
            fptr.unlock();
        }
    }
   
    /**
     * <p>Return the process id (pid) of the process this IO object
View Full Code Here

            long pos = fptr.tell(context);
            if (pos < 0 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
            pos -= fptr.rbuf.len;
            return context.runtime.newFixnum(pos);
        } finally {
            if (locked) fptr.unlock();
        }
    }

    // rb_io_set_pos
    @JRubyMethod(name = "pos=", required = 1)
View Full Code Here

        boolean locked = fptr.lock();
        try {
            pos = fptr.seek(context, pos, PosixShim.SEEK_SET);
            if (pos < 0 && fptr.errno() != null) throw context.runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
        } finally {
            if (locked) fptr.unlock();
        }

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

        boolean locked = fptr.lock();
        try {
            pos = fptr.seek(context, pos, whence);
            if (pos < 0 && fptr.errno() != null) throw getRuntime().newErrnoFromErrno(fptr.errno(), fptr.getPath());
        } finally {
            if (locked) fptr.unlock();
        }

        return RubyFixnum.zero(context.runtime);
    }
   
View Full Code Here

            }
            fptr.errno(null);
            pos = fptr.posix.lseek(fptr.fd(), pos, whence);
            if (pos == -1 && fptr.errno() != null) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
        } finally {
            if (locked) fptr.unlock();
        }

        return RubyFixnum.newFixnum(runtime, pos);
    }
View Full Code Here

            fptr.setLineNumber(0);
            if (fptr.readconv != null) {
                fptr.clearReadConversion();
            }
        } finally {
            if (locked) fptr.unlock();
        }

        return RubyFixnum.zero(runtime);
    }
View Full Code Here

                    throw runtime.newErrnoFromErrno(err, fptr.getPath());
                }
                fptr.setFD(tmpfd);
            }
        } finally {
            if (locked) fptr.unlock();
        }

        return file;
    }
View Full Code Here

            if (!str.isNil() && !noLimit) {
                fptr.incrementLineno(runtime);
            }
        } finally {
            if (locked) fptr.unlock();
        }

        return str;
    }
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.