org.jruby
Class RubyString

java.lang.Object
  extended by org.jruby.RubyObject
      extended by org.jruby.RubyString
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, InstanceVariables, InternalVariables, IRubyObject, CoreObjectType

public class RubyString
extends RubyObject

Implementation of Ruby String class Concurrency: no synchronization is required among readers, but all users must synchronize externally with writers.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Finalizer, RubyObject.ObjectMethods, RubyObject.VariableTableEntry
 
Field Summary
 
Fields inherited from class org.jruby.RubyObject
ALL_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, metaClass, NEVER, NIL_F, OBJECT_ALLOCATOR, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, VARIABLE_TABLE_DEFAULT_CAPACITY, VARIABLE_TABLE_EMPTY_TABLE, VARIABLE_TABLE_LOAD_FACTOR, VARIABLE_TABLE_MAXIMUM_CAPACITY, variableTable, variableTableSize, variableTableThreshold
 
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
 
Method Summary
 RubyString append(IRubyObject other)
          rb_str_append
 java.lang.String asJavaString()
          rb_to_id
 RubyString asString()
          rb_obj_as_string First converts this object into a String using the "to_s" method, infects it with the current taint and returns it.
static java.lang.String byteListToString(ByteList bytes)
           
static java.lang.String bytesToString(byte[] bytes)
           
static java.lang.String bytesToString(byte[] bytes, int beg, int len)
           
 IRubyObject capitalize_bang(ThreadContext context)
          rb_str_capitalize_bang
 IRubyObject capitalize(ThreadContext context)
          rb_str_capitalize
 IRubyObject casecmp(IRubyObject other)
           
 RubyString cat(byte[] str)
           
 RubyString cat(byte[] str, int beg, int len)
           
 RubyString cat(ByteList str)
           
 IRubyObject center(IRubyObject arg0)
          rb_str_center
 IRubyObject center(IRubyObject[] args)
          Deprecated. use the one or two argument versions.
 IRubyObject center(IRubyObject arg0, IRubyObject arg1)
          rb_str_center
 IRubyObject checkStringType()
          rb_check_string_type Tries to return a coerced string representation of this object, using "to_str".
 IRubyObject chomp_bang()
          rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0].
 IRubyObject chomp_bang(IRubyObject arg0)
          rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0].
 IRubyObject chomp_bang(IRubyObject[] args)
          Deprecated. Use the zero or one argument versions.
 RubyString chomp()
          rb_str_chop
 RubyString chomp(IRubyObject arg0)
          rb_str_chop
 RubyString chomp(IRubyObject[] args)
          Deprecated. Use the zero or one argument versions.
 IRubyObject chop_bang()
          rb_str_chop_bang
 IRubyObject chop(ThreadContext context)
           
 RubyString concat(IRubyObject other)
          rb_str_concat
 RubyString convertToString()
          Tries to convert this object to a Ruby String using the "to_str" method.
 IRubyObject count(IRubyObject[] args)
          rb_str_count
static RubyClass createStringClass(Ruby runtime)
           
 RubyString crypt(ThreadContext context, IRubyObject other)
          rb_str_crypt
 IRubyObject delete_bang(IRubyObject[] args)
          rb_str_delete_bang
 IRubyObject delete(ThreadContext context, IRubyObject[] args)
          rb_str_delete
 IRubyObject doClone()
           
 IRubyObject downcase_bang(ThreadContext context)
          rb_str_downcase_bang
 RubyString downcase(ThreadContext context)
          rb_str_downcase
 IRubyObject dump()
          rb_str_dump
 RubyString each_byte(ThreadContext context, Block block)
          rb_str_each_byte
 IRubyObject each_line(ThreadContext context, IRubyObject[] args, Block block)
          rb_str_each_line
 RubyBoolean empty_p(ThreadContext context)
          rb_str_empty
 void empty()
           
 boolean eql(IRubyObject other)
          short circuit for String key comparison
 boolean equals(java.lang.Object other)
          This method is just a wrapper around the Ruby "==" method, provided so that RubyObjects can be used as keys in the Java HashMap object underlying RubyHash.
 ByteList getByteList()
           
 byte[] getBytes()
           
 java.lang.Class getJavaClass()
          Will return the Java interface that most closely can represent this object, when working through JAva integration translations.
 int getNativeTypeIndex()
          This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.
 java.lang.String getUnicodeValue()
          used by ar-jdbc
 java.lang.CharSequence getValue()
           
 IRubyObject gsub_bang(ThreadContext context, IRubyObject[] args, Block block)
          Deprecated. Use the versions with one or two arguments.
 IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, Block block)
          rb_str_gsub_bang
 IRubyObject gsub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
          rb_str_gsub_bang
 IRubyObject gsub(ThreadContext context, IRubyObject[] args, Block block)
          Deprecated. Use the versions with one or two arguments.
 IRubyObject gsub(ThreadContext context, IRubyObject arg0, Block block)
          rb_str_gsub
 IRubyObject gsub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
          rb_str_gsub
 RubyFixnum hash()
          rb_obj_id Will return the hash code of this object.
 int hashCode()
          Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects.
 IRubyObject hex(ThreadContext context)
          rb_str_hex
 RubyBoolean include_p(ThreadContext context, IRubyObject obj)
          rb_str_include
 IRubyObject index(ThreadContext context, IRubyObject arg0)
          rb_str_index_m
 IRubyObject index(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with one or two args.
 IRubyObject index(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
          rb_str_index_m
 IRubyObject initialize()
          rb_obj_dummy Default initialize method.
 IRubyObject initialize(IRubyObject arg0)
           
 IRubyObject initialize(IRubyObject[] args, Block unusedBlock)
          Deprecated. Use the versions with zero or one arguments
 IRubyObject insert(ThreadContext context, IRubyObject indexArg, IRubyObject stringArg)
           
 IRubyObject inspect()
          rb_str_inspect
 RubySymbol intern()
          rb_str_intern
static boolean isAlnum(int c)
           
static boolean isDigit(int c)
           
 boolean isEmpty()
           
static boolean isLetter(int c)
           
static boolean isLower(int c)
           
static boolean isPrint(int c)
           
static boolean isUpper(int c)
           
 RubyFixnum length()
          rb_str_length
 IRubyObject ljust(IRubyObject arg0)
          rb_str_ljust
 IRubyObject ljust(IRubyObject[] args)
          Deprecated. use the one or two argument versions.
 IRubyObject ljust(IRubyObject arg0, IRubyObject arg1)
          rb_str_ljust
 IRubyObject lstrip_bang()
          rb_str_lstrip_bang
 IRubyObject lstrip(ThreadContext context)
          rb_str_lstrip
 RubyString makeShared(Ruby runtime, int index, int len)
           
 IRubyObject match(ThreadContext context, IRubyObject pattern)
          String#match(pattern) rb_str_match_m
 void modify()
          rb_str_modify
 void modify(int length)
          rb_str_modify (with length bytes ensured)
static RubyString newEmptyString(Ruby runtime)
           
static RubyString newEmptyString(Ruby runtime, RubyClass metaClass)
           
static RubyString newInstance(IRubyObject recv, IRubyObject[] args, Block block)
          rb_str_s_new
 RubyString newString(ByteList s)
          Deprecated.  
 RubyString newString(java.lang.CharSequence s)
          Deprecated.  
static RubyString newString(Ruby runtime, byte[] bytes)
           
static RubyString newString(Ruby runtime, byte[] bytes, int start, int length)
           
static RubyString newString(Ruby runtime, ByteList bytes)
           
static RubyString newString(Ruby runtime, java.lang.CharSequence str)
          rb_str_new2
static RubyString newString(Ruby runtime, RubyClass clazz, java.lang.CharSequence str)
          Deprecated. 
static RubyString newStringLight(Ruby runtime, ByteList bytes)
           
static RubyString newStringShared(Ruby runtime, byte[] bytes, int start, int length)
           
static RubyString newStringShared(Ruby runtime, ByteList bytes)
           
static RubyString newStringShared(Ruby runtime, RubyClass clazz, ByteList bytes)
           
static RubyString newStringShared(Ruby runtime, RubyString orig)
           
static RubyString newUnicodeString(Ruby runtime, java.lang.String str)
           
static RubyString objAsString(ThreadContext context, IRubyObject obj)
          rb_obj_as_string
 IRubyObject oct(ThreadContext context)
          rb_str_oct
 IRubyObject op_aref(ThreadContext context, IRubyObject arg)
          rb_str_aref, rb_str_aref_m
 IRubyObject op_aref(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with one or two args
 IRubyObject op_aref(ThreadContext context, IRubyObject arg1, IRubyObject arg2)
          rb_str_aref, rb_str_aref_m
 IRubyObject op_aset(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with two or three args.
 IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
          rb_str_aset, rb_str_aset_m
 IRubyObject op_aset(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
          rb_str_aset, rb_str_aset_m
 int op_cmp(RubyString other)
          rb_str_cmp
 IRubyObject op_cmp(ThreadContext context, IRubyObject other)
           
 IRubyObject op_equal(ThreadContext context, IRubyObject other)
          rb_obj_equal Will by default use identity equality to compare objects.
 IRubyObject op_format(ThreadContext context, IRubyObject arg)
           
 IRubyObject op_ge(ThreadContext context, IRubyObject other)
           
 IRubyObject op_gt(ThreadContext context, IRubyObject other)
           
 IRubyObject op_le(ThreadContext context, IRubyObject other)
           
 IRubyObject op_lt(ThreadContext context, IRubyObject other)
           
 IRubyObject op_match(ThreadContext context, IRubyObject other)
          rb_str_match
 IRubyObject op_match2(ThreadContext context)
          rb_str_match2
 IRubyObject op_mul(ThreadContext context, IRubyObject other)
           
 IRubyObject op_plus(ThreadContext context, IRubyObject other)
           
 IRubyObject replace(int beg, int len, RubyString replaceWith)
           
 RubyString replace(IRubyObject other)
          rb_str_replace_m
 RubyString reverse_bang()
           
 RubyString reverse(ThreadContext context)
           
 IRubyObject rindex(ThreadContext context, IRubyObject arg0)
          rb_str_rindex_m
 IRubyObject rindex(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with one or two arguments.
 IRubyObject rindex(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
          rb_str_rindex_m
 IRubyObject rjust(IRubyObject arg0)
          rb_str_rjust
 IRubyObject rjust(IRubyObject[] args)
          Deprecated. use the one or two argument versions.
 IRubyObject rjust(IRubyObject arg0, IRubyObject arg1)
          rb_str_rjust
 IRubyObject rstrip_bang()
          rb_str_rstrip_bang
 IRubyObject rstrip(ThreadContext context)
          rb_str_rstrip
 IRubyObject scan(ThreadContext context, IRubyObject arg, Block block)
          rb_str_scan
 void setValue(ByteList value)
           
 void setValue(java.lang.CharSequence value)
          Deprecated.  
 IRubyObject slice_bang(ThreadContext context, IRubyObject arg0)
          rb_str_slice_bang
 IRubyObject slice_bang(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with one or two args.
 IRubyObject slice_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
          rb_str_slice_bang
 RubyArray split(ThreadContext context)
          rb_str_split_m
 RubyArray split(ThreadContext context, IRubyObject arg0)
          rb_str_split_m
 RubyArray split(ThreadContext context, IRubyObject[] args)
          Deprecated. Use the versions with zero, one, or two args.
 RubyArray split(ThreadContext context, IRubyObject arg0, IRubyObject arg1)
          rb_str_split_m
 IRubyObject squeeze_bang(IRubyObject[] args)
          rb_str_squeeze_bang
 IRubyObject squeeze(ThreadContext context, IRubyObject[] args)
          rb_str_squeeze
 IRubyObject str_eql_p(ThreadContext context, IRubyObject other)
           
 RubyString strDup()
          Deprecated. 
 RubyString strDup(Ruby runtime)
           
static byte[] stringToBytes(java.lang.String string)
           
static RubyString stringValue(IRubyObject object)
           
 IRubyObject strip_bang()
          rb_str_strip_bang
 IRubyObject strip(ThreadContext context)
          rb_str_strip
 IRubyObject sub_bang(ThreadContext context, IRubyObject[] args, Block block)
          Deprecated. Use the versions with one or two arguments.
 IRubyObject sub_bang(ThreadContext context, IRubyObject arg0, Block block)
          rb_str_sub_bang
 IRubyObject sub_bang(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
          rb_str_sub_bang
 IRubyObject sub(ThreadContext context, IRubyObject[] args, Block block)
          Deprecated. Use the versions with one or two args.
 IRubyObject sub(ThreadContext context, IRubyObject arg0, Block block)
          rb_str_sub
 IRubyObject sub(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Block block)
          rb_str_sub
 IRubyObject substr(int beg, int len)
           
 IRubyObject substr(Ruby runtime, int beg, int len)
           
 IRubyObject succ_bang()
           
 IRubyObject succ(ThreadContext context)
           
 RubyInteger sum(IRubyObject[] args)
           
 IRubyObject swapcase_bang(ThreadContext context)
          rb_str_swapcase_bang
 RubyString swapcase(ThreadContext context)
          rb_str_swapcase
 IRubyObject to_f()
          rb_str_to_f
 IRubyObject to_i()
          rb_str_to_i
 IRubyObject to_i(IRubyObject arg0)
          rb_str_to_i
 IRubyObject to_i(IRubyObject[] args)
          Deprecated. Use the versions with zero or one args.
 IRubyObject to_java()
           
 IRubyObject to_s()
          rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj.
 RubySymbol to_sym()
           
 java.lang.String toString()
          The default toString method is just a wrapper that calls the Ruby "to_s" method.
 IRubyObject tr_bang(IRubyObject src, IRubyObject repl)
          rb_str_tr_bang
 IRubyObject tr_s_bang(IRubyObject src, IRubyObject repl)
          rb_str_tr_s_bang
 IRubyObject tr_s(ThreadContext context, IRubyObject src, IRubyObject repl)
          rb_str_tr_s
 IRubyObject tr(ThreadContext context, IRubyObject src, IRubyObject repl)
          rb_str_tr
static RubyString unmarshalFrom(UnmarshalStream input)
           
 RubyArray unpack(IRubyObject obj)
           
 IRubyObject upcase_bang(ThreadContext context)
          rb_str_upcase_bang
 RubyString upcase(ThreadContext context)
          rb_str_upcase
 IRubyObject upto(ThreadContext context, IRubyObject str, Block block)
          rb_str_upto_m
 IRubyObject upto(ThreadContext context, IRubyObject str, boolean excl, Block block)
           
 
Methods inherited from class org.jruby.RubyObject
addFinalizer, anyToString, as, attachToObjectSpace, callInit, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkFrozen, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToType, copySpecialInstanceVariables, createObjectClass, dataGetStruct, dataWrapStruct, display, dup, ensureInstanceVariablesSettable, eql_p, eqlInternal, equal_p, equalInternal, evalUnder, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, freeze, frozen_p, getFlag, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariableList, getInternalVariables, getMetaClass, getRuntime, getSingletonClass, getSingletonClassClone, getType, getVariableCount, getVariableList, getVariableMap, getVariableNameList, hasInstanceVariable, hasInternalVariable, hasVariables, id_deprecated, id, infectBy, initialize_copy, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isRubyVariable, isTaint, isTrue, kind_of_p, makeMetaClass, method, methods, nil_p, op_eqq, private_methods, protected_methods, public_methods, puts, rbClone, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, send, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setTaint, singleton_methods, specificEval, specificEval, specificEval, specificEval, specificEval, syncVariables, taint, tainted_p, testFrozen, to_a, type_deprecated, type, untaint, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableGetMap, variableTableGetMap, variableTableGetSize, variableTableGetTable, variableTableReadLocked, variableTableRehash, variableTableRemove, variableTableStore, variableTableSync
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createStringClass

public static RubyClass createStringClass(Ruby runtime)

eql

public final boolean eql(IRubyObject other)
short circuit for String key comparison

Specified by:
eql in interface IRubyObject
Overrides:
eql in class RubyObject

newString

public RubyString newString(java.lang.CharSequence s)
Deprecated. 

Create a new String which uses the same Ruby runtime and the same class like this String. This method should be used to satisfy RCR #38.


newString

public RubyString newString(ByteList s)
Deprecated. 

Create a new String which uses the same Ruby runtime and the same class like this String. This method should be used to satisfy RCR #38.


newString

public static RubyString newString(Ruby runtime,
                                   java.lang.CharSequence str)
rb_str_new2


newEmptyString

public static RubyString newEmptyString(Ruby runtime)

newEmptyString

public static RubyString newEmptyString(Ruby runtime,
                                        RubyClass metaClass)

newUnicodeString

public static RubyString newUnicodeString(Ruby runtime,
                                          java.lang.String str)

newString

@Deprecated
public static RubyString newString(Ruby runtime,
                                              RubyClass clazz,
                                              java.lang.CharSequence str)
Deprecated. 


newString

public static RubyString newString(Ruby runtime,
                                   byte[] bytes)

newString

public static RubyString newString(Ruby runtime,
                                   byte[] bytes,
                                   int start,
                                   int length)

newString

public static RubyString newString(Ruby runtime,
                                   ByteList bytes)

newStringLight

public static RubyString newStringLight(Ruby runtime,
                                        ByteList bytes)

newStringShared

public static RubyString newStringShared(Ruby runtime,
                                         RubyString orig)

newStringShared

public static RubyString newStringShared(Ruby runtime,
                                         ByteList bytes)

newStringShared

public static RubyString newStringShared(Ruby runtime,
                                         RubyClass clazz,
                                         ByteList bytes)

newStringShared

public static RubyString newStringShared(Ruby runtime,
                                         byte[] bytes,
                                         int start,
                                         int length)

getNativeTypeIndex

public int getNativeTypeIndex()
Description copied from class: RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex

Specified by:
getNativeTypeIndex in interface CoreObjectType
Overrides:
getNativeTypeIndex in class RubyObject
Returns:
the ClassIndex of the native type this object was constructed from
See Also:
org.jruby.runtime.ClassInde

getJavaClass

public java.lang.Class getJavaClass()
Description copied from class: RubyObject
Will return the Java interface that most closely can represent this object, when working through JAva integration translations.

Specified by:
getJavaClass in interface IRubyObject
Overrides:
getJavaClass in class RubyObject
Returns:
Class

convertToString

public RubyString convertToString()
Description copied from class: RubyObject
Tries to convert this object to a Ruby String using the "to_str" method.

Specified by:
convertToString in interface IRubyObject
Overrides:
convertToString in class RubyObject
Returns:

toString

public java.lang.String toString()
Description copied from class: RubyObject
The default toString method is just a wrapper that calls the Ruby "to_s" method.

Overrides:
toString in class RubyObject

strDup

@Deprecated
public final RubyString strDup()
Deprecated. 

rb_str_dup


strDup

public final RubyString strDup(Ruby runtime)

makeShared

public final RubyString makeShared(Ruby runtime,
                                   int index,
                                   int len)

modify

public final void modify()
rb_str_modify


modify

public final void modify(int length)
rb_str_modify (with length bytes ensured)


bytesToString

public static java.lang.String bytesToString(byte[] bytes,
                                             int beg,
                                             int len)

byteListToString

public static java.lang.String byteListToString(ByteList bytes)

bytesToString

public static java.lang.String bytesToString(byte[] bytes)

stringToBytes

public static byte[] stringToBytes(java.lang.String string)

isDigit

public static boolean isDigit(int c)

isUpper

public static boolean isUpper(int c)

isLower

public static boolean isLower(int c)

isLetter

public static boolean isLetter(int c)

isAlnum

public static boolean isAlnum(int c)

isPrint

public static boolean isPrint(int c)

asString

public RubyString asString()
Description copied from class: RubyObject
rb_obj_as_string First converts this object into a String using the "to_s" method, infects it with the current taint and returns it. If to_s doesn't return a Ruby String, RubyObject.anyToString() is used instead.

Specified by:
asString in interface IRubyObject
Overrides:
asString in class RubyObject
Returns:

checkStringType

public IRubyObject checkStringType()
Description copied from class: RubyObject
rb_check_string_type Tries to return a coerced string representation of this object, using "to_str". If that returns something other than a String or nil, an empty String will be returned.

Specified by:
checkStringType in interface IRubyObject
Overrides:
checkStringType in class RubyObject
Returns:

to_s

public IRubyObject to_s()
Description copied from class: RubyObject
rb_any_to_s call-seq: obj.to_s => string Returns a string representing obj. The default to_s prints the object's class and an encoding of the object id. As a special case, the top-level object that is the initial execution context of Ruby programs returns ``main.''

Overrides:
to_s in class RubyObject

op_cmp

public IRubyObject op_cmp(ThreadContext context,
                          IRubyObject other)

op_equal

public IRubyObject op_equal(ThreadContext context,
                            IRubyObject other)
Description copied from class: RubyObject
rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics.

Specified by:
op_equal in interface IRubyObject
Overrides:
op_equal in class RubyObject

op_plus

public IRubyObject op_plus(ThreadContext context,
                           IRubyObject other)

op_mul

public IRubyObject op_mul(ThreadContext context,
                          IRubyObject other)

op_format

public IRubyObject op_format(ThreadContext context,
                             IRubyObject arg)

hash

public RubyFixnum hash()
Description copied from class: RubyObject
rb_obj_id Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.

Overrides:
hash in class RubyObject

hashCode

public int hashCode()
Description copied from class: RubyObject
Override the Object#hashCode method to make sure that the Ruby hash is actually used as the hashcode for Ruby objects. If the Ruby "hash" method doesn't return a number, the Object#hashCode implementation will be used instead.

Overrides:
hashCode in class RubyObject

equals

public boolean equals(java.lang.Object other)
Description copied from class: RubyObject
This method is just a wrapper around the Ruby "==" method, provided so that RubyObjects can be used as keys in the Java HashMap object underlying RubyHash.

Overrides:
equals in class RubyObject

objAsString

public static RubyString objAsString(ThreadContext context,
                                     IRubyObject obj)
rb_obj_as_string


op_cmp

public int op_cmp(RubyString other)
rb_str_cmp


asJavaString

public java.lang.String asJavaString()
rb_to_id

Specified by:
asJavaString in interface IRubyObject
Overrides:
asJavaString in class RubyObject
Returns:
String the symbol name

doClone

public IRubyObject doClone()

cat

public RubyString cat(byte[] str)

cat

public RubyString cat(byte[] str,
                      int beg,
                      int len)

cat

public RubyString cat(ByteList str)

replace

public RubyString replace(IRubyObject other)
rb_str_replace_m


reverse

public RubyString reverse(ThreadContext context)

reverse_bang

public RubyString reverse_bang()

newInstance

public static RubyString newInstance(IRubyObject recv,
                                     IRubyObject[] args,
                                     Block block)
rb_str_s_new


initialize

public IRubyObject initialize(IRubyObject[] args,
                              Block unusedBlock)
Deprecated. Use the versions with zero or one arguments

Variable-arity version for compatibility. Not bound to Ruby.


initialize

public IRubyObject initialize()
Description copied from class: RubyObject
rb_obj_dummy Default initialize method. This one gets defined in some other place as a Ruby method.

Overrides:
initialize in class RubyObject

initialize

public IRubyObject initialize(IRubyObject arg0)

casecmp

public IRubyObject casecmp(IRubyObject other)

op_match

public IRubyObject op_match(ThreadContext context,
                            IRubyObject other)
rb_str_match

Overrides:
op_match in class RubyObject

op_match2

public IRubyObject op_match2(ThreadContext context)
rb_str_match2


match

public IRubyObject match(ThreadContext context,
                         IRubyObject pattern)
String#match(pattern) rb_str_match_m

Parameters:
pattern - Regexp or String

capitalize

public IRubyObject capitalize(ThreadContext context)
rb_str_capitalize


capitalize_bang

public IRubyObject capitalize_bang(ThreadContext context)
rb_str_capitalize_bang


op_ge

public IRubyObject op_ge(ThreadContext context,
                         IRubyObject other)

op_gt

public IRubyObject op_gt(ThreadContext context,
                         IRubyObject other)

op_le

public IRubyObject op_le(ThreadContext context,
                         IRubyObject other)

op_lt

public IRubyObject op_lt(ThreadContext context,
                         IRubyObject other)

str_eql_p

public IRubyObject str_eql_p(ThreadContext context,
                             IRubyObject other)

upcase

public RubyString upcase(ThreadContext context)
rb_str_upcase


upcase_bang

public IRubyObject upcase_bang(ThreadContext context)
rb_str_upcase_bang


downcase

public RubyString downcase(ThreadContext context)
rb_str_downcase


downcase_bang

public IRubyObject downcase_bang(ThreadContext context)
rb_str_downcase_bang


swapcase

public RubyString swapcase(ThreadContext context)
rb_str_swapcase


swapcase_bang

public IRubyObject swapcase_bang(ThreadContext context)
rb_str_swapcase_bang


dump

public IRubyObject dump()
rb_str_dump


insert

public IRubyObject insert(ThreadContext context,
                          IRubyObject indexArg,
                          IRubyObject stringArg)

inspect

public IRubyObject inspect()
rb_str_inspect

Specified by:
inspect in interface IRubyObject
Overrides:
inspect in class RubyObject
Returns:
String

length

public RubyFixnum length()
rb_str_length


empty_p

public RubyBoolean empty_p(ThreadContext context)
rb_str_empty


isEmpty

public boolean isEmpty()

append

public RubyString append(IRubyObject other)
rb_str_append


concat

public RubyString concat(IRubyObject other)
rb_str_concat


crypt

public RubyString crypt(ThreadContext context,
                        IRubyObject other)
rb_str_crypt


stringValue

public static RubyString stringValue(IRubyObject object)

sub

public IRubyObject sub(ThreadContext context,
                       IRubyObject[] args,
                       Block block)
Deprecated. Use the versions with one or two args.

Variable-arity version for compatibility. Not bound to Ruby.


sub

public IRubyObject sub(ThreadContext context,
                       IRubyObject arg0,
                       Block block)
rb_str_sub


sub

public IRubyObject sub(ThreadContext context,
                       IRubyObject arg0,
                       IRubyObject arg1,
                       Block block)
rb_str_sub


sub_bang

public IRubyObject sub_bang(ThreadContext context,
                            IRubyObject[] args,
                            Block block)
Deprecated. Use the versions with one or two arguments.

Variable-arity version for compatibility. Not bound to Ruby.


sub_bang

public IRubyObject sub_bang(ThreadContext context,
                            IRubyObject arg0,
                            Block block)
rb_str_sub_bang


sub_bang

public IRubyObject sub_bang(ThreadContext context,
                            IRubyObject arg0,
                            IRubyObject arg1,
                            Block block)
rb_str_sub_bang


gsub

public IRubyObject gsub(ThreadContext context,
                        IRubyObject[] args,
                        Block block)
Deprecated. Use the versions with one or two arguments.

Variable-arity version for compatibility. Not bound to Ruby.


gsub

public IRubyObject gsub(ThreadContext context,
                        IRubyObject arg0,
                        Block block)
rb_str_gsub


gsub

public IRubyObject gsub(ThreadContext context,
                        IRubyObject arg0,
                        IRubyObject arg1,
                        Block block)
rb_str_gsub


gsub_bang

public IRubyObject gsub_bang(ThreadContext context,
                             IRubyObject[] args,
                             Block block)
Deprecated. Use the versions with one or two arguments.

Variable-arity version for compatibility. Not bound to Ruby.


gsub_bang

public IRubyObject gsub_bang(ThreadContext context,
                             IRubyObject arg0,
                             Block block)
rb_str_gsub_bang


gsub_bang

public IRubyObject gsub_bang(ThreadContext context,
                             IRubyObject arg0,
                             IRubyObject arg1,
                             Block block)
rb_str_gsub_bang


index

public IRubyObject index(ThreadContext context,
                         IRubyObject[] args)
Deprecated. Use the versions with one or two args.

Variable-arity version for compatibility. Not bound to Ruby.


index

public IRubyObject index(ThreadContext context,
                         IRubyObject arg0)
rb_str_index_m


index

public IRubyObject index(ThreadContext context,
                         IRubyObject arg0,
                         IRubyObject arg1)
rb_str_index_m


rindex

public IRubyObject rindex(ThreadContext context,
                          IRubyObject[] args)
Deprecated. Use the versions with one or two arguments.

Variable-arity version for compatibility. Not bound to Ruby.


rindex

public IRubyObject rindex(ThreadContext context,
                          IRubyObject arg0)
rb_str_rindex_m


rindex

public IRubyObject rindex(ThreadContext context,
                          IRubyObject arg0,
                          IRubyObject arg1)
rb_str_rindex_m


substr

public IRubyObject substr(int beg,
                          int len)

substr

public IRubyObject substr(Ruby runtime,
                          int beg,
                          int len)

replace

public IRubyObject replace(int beg,
                           int len,
                           RubyString replaceWith)

op_aref

public IRubyObject op_aref(ThreadContext context,
                           IRubyObject[] args)
Deprecated. Use the versions with one or two args

Variable-arity version for compatibility. Not bound to Ruby.


op_aref

public IRubyObject op_aref(ThreadContext context,
                           IRubyObject arg1,
                           IRubyObject arg2)
rb_str_aref, rb_str_aref_m


op_aref

public IRubyObject op_aref(ThreadContext context,
                           IRubyObject arg)
rb_str_aref, rb_str_aref_m


op_aset

public IRubyObject op_aset(ThreadContext context,
                           IRubyObject[] args)
Deprecated. Use the versions with two or three args.

Variable arity version for compatibility. Not bound to a Ruby method.


op_aset

public IRubyObject op_aset(ThreadContext context,
                           IRubyObject arg0,
                           IRubyObject arg1)
rb_str_aset, rb_str_aset_m


op_aset

public IRubyObject op_aset(ThreadContext context,
                           IRubyObject arg0,
                           IRubyObject arg1,
                           IRubyObject arg2)
rb_str_aset, rb_str_aset_m


slice_bang

public IRubyObject slice_bang(ThreadContext context,
                              IRubyObject[] args)
Deprecated. Use the versions with one or two args.

Variable arity version for compatibility. Not bound as a Ruby method.


slice_bang

public IRubyObject slice_bang(ThreadContext context,
                              IRubyObject arg0)
rb_str_slice_bang


slice_bang

public IRubyObject slice_bang(ThreadContext context,
                              IRubyObject arg0,
                              IRubyObject arg1)
rb_str_slice_bang


succ

public IRubyObject succ(ThreadContext context)

succ_bang

public IRubyObject succ_bang()

upto

public IRubyObject upto(ThreadContext context,
                        IRubyObject str,
                        Block block)
rb_str_upto_m


upto

public IRubyObject upto(ThreadContext context,
                        IRubyObject str,
                        boolean excl,
                        Block block)

include_p

public RubyBoolean include_p(ThreadContext context,
                             IRubyObject obj)
rb_str_include


to_i

public IRubyObject to_i(IRubyObject[] args)
Deprecated. Use the versions with zero or one args.

Variable-arity version for compatibility. Not bound as a Ruby method.


to_i

public IRubyObject to_i()
rb_str_to_i


to_i

public IRubyObject to_i(IRubyObject arg0)
rb_str_to_i


oct

public IRubyObject oct(ThreadContext context)
rb_str_oct


hex

public IRubyObject hex(ThreadContext context)
rb_str_hex


to_f

public IRubyObject to_f()
rb_str_to_f


split

public RubyArray split(ThreadContext context,
                       IRubyObject[] args)
Deprecated. Use the versions with zero, one, or two args.

Variable arity version for compatibility. Not bound to a Ruby method.


split

public RubyArray split(ThreadContext context)
rb_str_split_m


split

public RubyArray split(ThreadContext context,
                       IRubyObject arg0)
rb_str_split_m


split

public RubyArray split(ThreadContext context,
                       IRubyObject arg0,
                       IRubyObject arg1)
rb_str_split_m


scan

public IRubyObject scan(ThreadContext context,
                        IRubyObject arg,
                        Block block)
rb_str_scan


ljust

public IRubyObject ljust(IRubyObject[] args)
Deprecated. use the one or two argument versions.

Variable-arity version for compatibility. Not bound to Ruby.


ljust

public IRubyObject ljust(IRubyObject arg0)
rb_str_ljust


ljust

public IRubyObject ljust(IRubyObject arg0,
                         IRubyObject arg1)
rb_str_ljust


rjust

public IRubyObject rjust(IRubyObject[] args)
Deprecated. use the one or two argument versions.

Variable-arity version for compatibility. Not bound to Ruby.


rjust

public IRubyObject rjust(IRubyObject arg0)
rb_str_rjust


rjust

public IRubyObject rjust(IRubyObject arg0,
                         IRubyObject arg1)
rb_str_rjust


center

public IRubyObject center(IRubyObject[] args)
Deprecated. use the one or two argument versions.

Variable-arity version for compatibility. Not bound to Ruby.


center

public IRubyObject center(IRubyObject arg0)
rb_str_center


center

public IRubyObject center(IRubyObject arg0,
                          IRubyObject arg1)
rb_str_center


chop

public IRubyObject chop(ThreadContext context)

chop_bang

public IRubyObject chop_bang()
rb_str_chop_bang


chomp

public RubyString chomp(IRubyObject[] args)
Deprecated. Use the zero or one argument versions.

Variable-arity version for compatibility. Not bound to Ruby

Parameters:
args -
Returns:

chomp

public RubyString chomp()
rb_str_chop


chomp

public RubyString chomp(IRubyObject arg0)
rb_str_chop


chomp_bang

public IRubyObject chomp_bang(IRubyObject[] args)
Deprecated. Use the zero or one argument versions.

Variable-arity version for compatibility. Not bound to Ruby.


chomp_bang

public IRubyObject chomp_bang()
rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0]. If args.length==0 removes one instance of CR, CRLF or LF from the end of the string. If args.length>0 and args[0] is "\n" then same behaviour as args.length==0 . If args.length>0 and args[0] is "" then removes trailing multiple LF or CRLF (but no CRs at all(!)).

Parameters:
args - See method description.

chomp_bang

public IRubyObject chomp_bang(IRubyObject arg0)
rb_str_chomp_bang In the common case, removes CR and LF characters in various ways depending on the value of the optional args[0]. If args.length==0 removes one instance of CR, CRLF or LF from the end of the string. If args.length>0 and args[0] is "\n" then same behaviour as args.length==0 . If args.length>0 and args[0] is "" then removes trailing multiple LF or CRLF (but no CRs at all(!)).

Parameters:
args - See method description.

lstrip

public IRubyObject lstrip(ThreadContext context)
rb_str_lstrip


lstrip_bang

public IRubyObject lstrip_bang()
rb_str_lstrip_bang


rstrip

public IRubyObject rstrip(ThreadContext context)
rb_str_rstrip


rstrip_bang

public IRubyObject rstrip_bang()
rb_str_rstrip_bang


strip

public IRubyObject strip(ThreadContext context)
rb_str_strip


strip_bang

public IRubyObject strip_bang()
rb_str_strip_bang


count

public IRubyObject count(IRubyObject[] args)
rb_str_count


delete

public IRubyObject delete(ThreadContext context,
                          IRubyObject[] args)
rb_str_delete


delete_bang

public IRubyObject delete_bang(IRubyObject[] args)
rb_str_delete_bang


squeeze

public IRubyObject squeeze(ThreadContext context,
                           IRubyObject[] args)
rb_str_squeeze


squeeze_bang

public IRubyObject squeeze_bang(IRubyObject[] args)
rb_str_squeeze_bang


tr

public IRubyObject tr(ThreadContext context,
                      IRubyObject src,
                      IRubyObject repl)
rb_str_tr


tr_bang

public IRubyObject tr_bang(IRubyObject src,
                           IRubyObject repl)
rb_str_tr_bang


tr_s

public IRubyObject tr_s(ThreadContext context,
                        IRubyObject src,
                        IRubyObject repl)
rb_str_tr_s


tr_s_bang

public IRubyObject tr_s_bang(IRubyObject src,
                             IRubyObject repl)
rb_str_tr_s_bang


each_line

public IRubyObject each_line(ThreadContext context,
                             IRubyObject[] args,
                             Block block)
rb_str_each_line


each_byte

public RubyString each_byte(ThreadContext context,
                            Block block)
rb_str_each_byte


intern

public RubySymbol intern()
rb_str_intern


to_sym

public RubySymbol to_sym()

sum

public RubyInteger sum(IRubyObject[] args)

unmarshalFrom

public static RubyString unmarshalFrom(UnmarshalStream input)
                                throws java.io.IOException
Throws:
java.io.IOException

unpack

public RubyArray unpack(IRubyObject obj)
See Also:
Pack.unpack(org.jruby.Ruby, ByteList, ByteList)

empty

public void empty()

setValue

public void setValue(java.lang.CharSequence value)
Deprecated. 

Mutator for internal string representation.

Parameters:
value - The new java.lang.String this RubyString should encapsulate

setValue

public void setValue(ByteList value)

getValue

public java.lang.CharSequence getValue()

getBytes

public byte[] getBytes()

getByteList

public ByteList getByteList()

getUnicodeValue

public java.lang.String getUnicodeValue()
used by ar-jdbc


to_java

public IRubyObject to_java()
Overrides:
to_java in class RubyObject


Copyright © 2002-2007 JRuby Team. All Rights Reserved.