Package org.jruby

Examples of org.jruby.RubyString.clear()


   */
  public static void setString(IRubyObject irb, String text) {
    // is string?
    if (irb instanceof RubyString) {
      RubyString rs = (RubyString) irb;
      rs.clear();
      rs.append(RubyString.newString(irb.getRuntime(), text));
    } else {
      throw new IllegalArgumentException(irb + " is not a String");
    }

View Full Code Here


            str = args[1].convertToString();
        } else {
            str = getRuntime().newString("");
        }
        if(len == 0) {
            str.clear();
            return str;
        }
        if (len < 0) {
            throw runtime.newArgumentError("negative string size (or size too big)");
        }
View Full Code Here

            return lengthGiven ? getRuntime().getNil() : RubyString.newEmptyString(getRuntime());
        }

        byte[] bytes = byteBufferToBytes(byteBuffer, bytesRead);
        if (stringBuffer != null) {
            stringBuffer.clear();
            stringBuffer.cat(bytes);
        } else {
            stringBuffer = getRuntime().newString(new ByteList(bytes));
        }
        while (bytesRead != -1 && totalBytesRead < bytesToRead) {
View Full Code Here

        try {
            byte[] bytes = readUntil(Integer.MAX_VALUE, count);
            if (bytes != null) {
                if (string != null) {
                    string.clear();
                    string.cat(bytes);
                    return string;
                }
                return getRuntime().newString(new ByteList(bytes));
            } 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.