Examples of checkWritable()


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

       
        try {
            RubyString string = obj.asString();
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkWritable(runtime);
           
            Stream writeStream = myOpenFile.getWriteStream();
           
            if (myOpenFile.isWriteBuffered()) {
                runtime.getWarnings().warn(ID.SYSWRITE_BUFFERED_IO, "syswrite for buffered IO");
View Full Code Here

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

        // MRI behavior: always check whether the file is writable
        // or not, even if we are to write 0 bytes.
        OpenFile myOpenFile = getOpenFileChecked();

        try {
            myOpenFile.checkWritable(context.getRuntime());
            RubyString str = obj.asString();
            if (str.getByteList().length() == 0) {
                return context.getRuntime().newFixnum(0);
            }
View Full Code Here

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

        }

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

            int written = fwrite(str.getByteList());

            if (written == -1) {
                // TODO: sys fail
View Full Code Here

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

    @JRubyMethod(name = "putc", required = 1, backtrace = true)
    public IRubyObject putc(ThreadContext context, IRubyObject object) {

        try {
            OpenFile myOpenFile = getOpenFileChecked();           
            myOpenFile.checkWritable(context.getRuntime());
            Stream writeStream = myOpenFile.getWriteStream();
            writeStream.fputc(RubyNumeric.num2chr(object));
            if (myOpenFile.isSync()) myOpenFile.fflush(writeStream);
        } catch (IOException ex) {
            throw context.getRuntime().newIOErrorFromException(ex);
View Full Code Here

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

        Ruby runtime = context.getRuntime();
       
        try {
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkWritable(runtime);
       
            myOpenFile.getWriteStream().sync();
        } catch (InvalidValueException ex) {
            throw runtime.newErrnoEINVALError();
        } catch (PipeException ex) {
View Full Code Here

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

       
        try {
            RubyString string = obj.asString();
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkWritable(runtime);
           
            Stream writeStream = myOpenFile.getWriteStream();
           
            if (myOpenFile.isWriteBuffered()) {
                runtime.getWarnings().warn(ID.SYSWRITE_BUFFERED_IO, "syswrite for buffered IO");
View Full Code Here

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

        // MRI behavior: always check whether the file is writable
        // or not, even if we are to write 0 bytes.
        OpenFile myOpenFile = getOpenFileChecked();

        try {
            myOpenFile.checkWritable(context.getRuntime());
            RubyString str = obj.asString();
            if (str.getByteList().length() == 0) {
                return context.getRuntime().newFixnum(0);
            }
View Full Code Here

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

        }

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

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

            if (written == -1) {
View Full Code Here

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

        if (maybeIO instanceof RubyIO) {
            // FIXME we should probably still be dyncalling 'write' here
            RubyIO io = (RubyIO)maybeIO;
            try {
                OpenFile myOpenFile = io.getOpenFileChecked();
                myOpenFile.checkWritable(context.getRuntime());
                Stream writeStream = myOpenFile.getWriteStream();
                writeStream.fputc(c);
                if (myOpenFile.isSync()) myOpenFile.fflush(writeStream);
            } catch (IOException ex) {
                throw context.getRuntime().newIOErrorFromException(ex);
View Full Code Here

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

        Ruby runtime = context.getRuntime();
       
        try {
            OpenFile myOpenFile = getOpenFileChecked();
           
            myOpenFile.checkWritable(runtime);
       
            Stream writeStream = myOpenFile.getWriteStream();

            writeStream.fflush();
            writeStream.sync();
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.