Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jruby.ext.io.try_nonblock;
 
 import org.jruby.Ruby;
Adds try_read_nonblock and try_write_nonblock to IO.
public class IOTryNonblockLibrary implements Library {
    @Override
    public void load(Ruby runtimeboolean wrapthrows IOException {
        runtime.getIO().defineAnnotatedMethods(IOTryNonblockLibrary.class);
    }
    
    @JRubyMethod(name = "try_read_nonblock", required = 1, optional = 1)
    public static IRubyObject try_read_nonblock(ThreadContext contextIRubyObject ioIRubyObject[] args) {
        return ((RubyIO)io).doReadNonblock(contextargsfalse);
    }
    
    @JRubyMethod(name = "try_write_nonblock", required = 1)
    public static IRubyObject try_write_nonblock(ThreadContext contextIRubyObject ioIRubyObject obj) {
        return ((RubyIO)io).doWriteNonblock(contextobjfalse);
    }
New to GrepCode? Check out our FAQ X