Package org.jruby.util

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


           
            if (length > rest) length = rest;

            // Yow...this is ugly
            buf.realSize = length;
            buf.replace(0, length, internal.getByteList().bytes, (int) pos, length);
        }
       
        if (buf == null) {
            if (!eof) buf = new ByteList();
            length = 0;
View Full Code Here


            case '\'': rep = SINGLE; break;
            case '\\': rep = ESCAPE; break;
            }

            if (rep != null) {
                newBytes.replace(i, 1, rep);
                i += rep.length - 1; // We subtract one since for loop already adds one
            }
        }

        // Nothing changed, can return original
View Full Code Here

        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);

        return context.getRuntime().newString(newBytes);
View Full Code Here

                i-= bl.begin;
                bl = new ByteList(bl);
                replacementFound = true;
            }

            bl.replace(i, 1, TWO_SINGLE);
            i+=1;
        }
        if(replacementFound) {
            return recv.getRuntime().newStringShared(bl);
        } else {
View Full Code Here

       
        ByteList bytes = ptr.string.getByteList();
       
        if (isEndOfString()) bytes.length(Math.max(ptr.pos, len));

        bytes.replace(start, ptr.pos - start, ungetBytes.getByteList());
       
        ptr.pos = start;
    }
   
    @JRubyMethod
View Full Code Here

            if ( ! replacement ) {
                bytes = new ByteList(bytes);
                replacement = true;
            }

            bytes.replace(i, 1, BYTES_SINGLE_Q_x2);
            i += 1;
        }

        return replacement ? RubyString.newStringShared(self.getRuntime(), bytes) : string;
    }
View Full Code Here

                i-= bl.begin;
                bl = new ByteList(bl);
                replacementFound = true;
            }

            bl.replace(i, 1, TWO_SINGLE);
            i+=1;
        }
        if(replacementFound) {
            return recv.getRuntime().newStringShared(bl);
        } else {
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.