Package org.jruby

Examples of org.jruby.Ruby.newFixnum()


            if (count < buffer.remaining()) {
                buffer = buffer.duplicate();
                buffer.limit(count);
            }
           
            return runtime.newFixnum(stream.read(buffer));

        } catch (InvalidValueException ex) {
            throw runtime.newErrnoEINVALError();
        } catch (EOFException e) {
            return runtime.newFixnum(-1);
View Full Code Here


            return runtime.newFixnum(stream.read(buffer));

        } catch (InvalidValueException ex) {
            throw runtime.newErrnoEINVALError();
        } catch (EOFException e) {
            return runtime.newFixnum(-1);
        } catch (BadDescriptorException e) {
            throw runtime.newErrnoEBADFError();
        } catch (IOException e) {
            throw runtime.newIOErrorFromException(e);
        }
View Full Code Here

        for (IRubyObject name : fieldNames) {
            RubyArray offset = RubyArray.newArray(runtime);
            // Assemble a [ :name, offset ] array
            offset.append(name);
            offset.append(runtime.newFixnum(getMember(runtime, name).offset));
            offsets.append(offset);
        }

        return offsets;
    }
View Full Code Here

            setArgv(list.toArray(new String[0]));
            setCompatVersion(compat);
        }};
        final Ruby runtime = Ruby.newInstance(config);

        runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime))));

        tar.hookIntoRuntime(runtime);

        Thread t2 = new Thread() {
            public void run() {
View Full Code Here

            RubyString data = _mesg.convertToString();
            ByteBuffer buf = ByteBuffer.wrap(data.getBytes());

            written = ((DatagramChannel) this.getChannel()).write(buf);

            return runtime.newFixnum(written);

        } catch (NotYetConnectedException nyce) {
            throw runtime.newErrnoEDESTADDRREQError("send(2)");

        } catch (UnknownHostException e) {
View Full Code Here

                ms.send(sendDP);
                written = sendDP.getLength();
            }

            return runtime.newFixnum(written);

        } catch (UnknownHostException e) {
            throw SocketUtils.sockerr(runtime, "send: name or service not known");

        } catch (IOException e) {
View Full Code Here

    @JRubyMethod
    public IRubyObject rewind() {
        Ruby rt = getRuntime();
        // should invoke seek on realIo...
        realIo.callMethod(rt.getCurrentContext(), "seek",
                new IRubyObject[]{rt.newFixnum(-internalPosition()), rt.newFixnum(Stream.SEEK_CUR)});
        // ... and then reinitialize
        initialize(realIo);
        return getRuntime().getNil();
    }
View Full Code Here

    @JRubyMethod
    public IRubyObject rewind() {
        Ruby rt = getRuntime();
        // should invoke seek on realIo...
        realIo.callMethod(rt.getCurrentContext(), "seek",
                new IRubyObject[]{rt.newFixnum(-internalPosition()), rt.newFixnum(Stream.SEEK_CUR)});
        // ... and then reinitialize
        initialize(realIo);
        return getRuntime().getNil();
    }
View Full Code Here

                    // generated keys
                    keys = sqlStatement.getGeneratedKeys();

                } else if (hasReturnParam) {
                    // Used in Oracle for INSERT ... RETURNING ... INTO ... statements
                    insert_key = runtime.newFixnum(driver.getPreparedStatementReturnParam(sqlStatement));
                } else {
                    // If there is no support, then a custom method can be defined
                    // to return a ResultSet with keys
                    keys = driver.getGeneratedKeys(conn);
                    // The OpenEdge driver needs additional information
View Full Code Here

            keys = null;
            sqlStatement = null;
            sqlSimpleStatement = null;
        }

        IRubyObject affected_rows = runtime.newFixnum(affectedCount);

        return api.callMethod(resultClass, "new",
                new IRubyObject[] {this, affected_rows, insert_key });
    }
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.