This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

classpath-098-merge-branch: Add a new String constructor


This is for the new CPStringBuilder.

Andrew.


2008-09-22  Andrew Haley  <aph@redhat.com>

        * java/lang/String.java (toString(char[], int, int)): New method.

Index: java/lang/String.java
===================================================================
--- java/lang/String.java       (revision 140485)
+++ java/lang/String.java       (working copy)
@@ -1440,6 +1440,14 @@
     return count == 0;
   }

+  // Generate a String that shares the value array: subsequent changes
+  // to this array will affect the String.  A private internal method
+  // that is called from CPStringBuilder by compiler-generated code.
+  private static String toString(char[] value, int startIndex, int count)
+  {
+    return new String(value, startIndex, count, true);
+  }
+
   private native void init(char[] chars, int offset, int count,
                           boolean dont_copy);
   private native void init(byte[] chars, int hibyte, int offset, int count);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]