Package org.jruby.util

Examples of org.jruby.util.ByteList.indexOf()


                if (pos == ss.realSize) {
                    return runtime.getNil();
                }
            }

            int ix = ss.indexOf(sep, (int)pos);

            ByteList add;
            if (-1 == ix) {
                ix = internal.getByteList().realSize;
                add = new ByteList(new byte[0], false);
View Full Code Here


                if (data.pos == ss.getRealSize()) {
                    return runtime.getNil();
                }
            }

            int ix = ss.indexOf(sep, (int)data.pos);

            ByteList add;
            if (-1 == ix) {
                ix = data.internal.getByteList().getRealSize();
                add = ByteList.EMPTY_BYTELIST;
View Full Code Here

        if (Double.isInfinite(value)) return RubyString.newString(runtime, value < 0 ? "-Infinity" : "Infinity");
        if (Double.isNaN(value)) return RubyString.newString(runtime, "NaN");

        ByteList buf = new ByteList();
        Sprintf.sprintf(buf, Locale.US, "%#.15g", this);
        int e = buf.indexOf('e');
        if (e == -1) e = buf.getRealSize();
        ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;

        if (!ascii.isDigit(buf.get(e - 1))) {
            buf.setRealSize(0);
View Full Code Here

        ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;

        if (!ascii.isDigit(buf.get(e - 1))) {
            buf.setRealSize(0);
            Sprintf.sprintf(buf, Locale.US, "%#.14e", this);
            e = buf.indexOf('e');
            if (e == -1) e = buf.getRealSize();
        }

        int p = e;
        while (buf.get(p - 1) == '0' && ascii.isDigit(buf.get(p - 2))) p--;
View Full Code Here

        if (runtime.is1_9()) {
            Sprintf.sprintf(buf, Locale.US, "%#.20g", this);
        } else {
            Sprintf.sprintf(buf, Locale.US, "%#.15g", this);
        }
        int e = buf.indexOf('e');
        if (e == -1) e = buf.getRealSize();
        ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;

        if (!ascii.isDigit(buf.get(e - 1))) {
            buf.setRealSize(0);
View Full Code Here

        ASCIIEncoding ascii = ASCIIEncoding.INSTANCE;

        if (!ascii.isDigit(buf.get(e - 1))) {
            buf.setRealSize(0);
            Sprintf.sprintf(buf, Locale.US, "%#.14e", this);
            e = buf.indexOf('e');
            if (e == -1) e = buf.getRealSize();
        }

        int p = e;
        while (buf.get(p - 1) == '0' && ascii.isDigit(buf.get(p - 2))) p--;
View Full Code Here

                if (data.pos == ss.getRealSize()) {
                    return runtime.getNil();
                }
            }

            int ix = ss.indexOf(sep, (int)data.pos);

            ByteList add;
            if (-1 == ix) {
                ix = data.internal.getByteList().getRealSize();
                add = ByteList.EMPTY_BYTELIST;
View Full Code Here

        // StringIO.new("あいう").gets(3) => "あ"
        // StringIO.new("あいう").gets(4) => "あい"
        // StringIO.new("あいう").gets(5) => "あい"
        // StringIO.new("あいう").gets(6) => "あい"
        // StringIO.new("あいう").gets(7) => "あいう"
        while (result.indexOf(sep) == -1) {
            ce = bufferedStream.read();

            if (ce == -1) break;

            result.append(ce);
View Full Code Here

        ByteList newBytes = new ByteList();

        newBytes.insert(0, BACKQUOTE);
        newBytes.append(bytes);
        int i = 0, j = 0;
        while ((i = newBytes.indexOf('.', j)) != -1) {
            newBytes.replace(i, 1, QUOTED_DOT);
            j = i+3;
        }
        newBytes.append(BACKQUOTE);
View Full Code Here

            IRubyObject key = entry.getKey();
            IRubyObject val = entry.getValue();
            ByteList k;

            k = StringSupport.checkEmbeddedNulls(runtime, key).getByteList();
            if (k.indexOf('=') != -1)
                throw runtime.newArgumentError("environment name contains a equal : " + k);

            if (!val.isNil())
                StringSupport.checkEmbeddedNulls(runtime, val);
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.