org.jikesrvm.mm.mmtk
Class Strings

java.lang.Object
  extended by org.mmtk.vm.Strings
      extended by org.jikesrvm.mm.mmtk.Strings

public final class Strings
extends Strings


Constructor Summary
Strings()
           
 
Method Summary
 int copyStringToChars(String str, char[] dst, int dstBegin, int dstEnd)
          Copies characters from the string into the character array.
private  int naiveCopyStringToChars(String str, char[] dst, int dstBegin, int dstEnd)
          Copies characters from the string into the character array.
private  int safeCopyStringToChars(String str, char[] dst, int dstBegin, int dstEnd)
          Copies characters from the string into the character array.
 void write(char[] c, int len)
          Log a message.
 void writeThreadId(char[] c, int len)
          Log a thread identifier and a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Strings

public Strings()
Method Detail

write

public void write(char[] c,
                  int len)
Description copied from class: Strings
Log a message.

Specified by:
write in class Strings
Parameters:
c - character array with message starting at index 0
len - number of characters in message

writeThreadId

public void writeThreadId(char[] c,
                          int len)
Description copied from class: Strings
Log a thread identifier and a message.

Specified by:
writeThreadId in class Strings
Parameters:
c - character array with message starting at index 0
len - number of characters in message

copyStringToChars

public int copyStringToChars(String str,
                             char[] dst,
                             int dstBegin,
                             int dstEnd)
Description copied from class: Strings
Copies characters from the string into the character array. Thread switching is disabled during this method's execution.

TODO: There are special memory management semantics here that someone should document.

Specified by:
copyStringToChars in class Strings
Parameters:
str - the source string
dst - the destination array
dstBegin - the start offset in the destination array
dstEnd - the index after the last character in the destination to copy to
Returns:
the number of characters copied.

safeCopyStringToChars

private int safeCopyStringToChars(String str,
                                  char[] dst,
                                  int dstBegin,
                                  int dstEnd)
Copies characters from the string into the character array. Thread switching is disabled during this method's execution.

TODO: There are special memory management semantics here that someone should document.

Parameters:
str - the source string
dst - the destination array
dstBegin - the start offset in the destination array
dstEnd - the index after the last character in the destination to copy to
Returns:
the number of characters copied.

naiveCopyStringToChars

private int naiveCopyStringToChars(String str,
                                   char[] dst,
                                   int dstBegin,
                                   int dstEnd)
Copies characters from the string into the character array. Thread switching is disabled during this method's execution.

Parameters:
str - the source string
dst - the destination array
dstBegin - the start offset in the destination array
dstEnd - the index after the last character in the destination to copy to
Returns:
the number of characters copied.