1.1 --- a/emul/src/main/java/java/lang/String.java Mon Oct 08 17:10:27 2012 -0700
1.2 +++ b/emul/src/main/java/java/lang/String.java Tue Oct 16 11:55:56 2012 +0200
1.3 @@ -164,7 +164,7 @@
1.4 // String itself. Perhaps this constructor is being called
1.5 // in order to trim the baggage, so make a copy of the array.
1.6 int off = original.offset;
1.7 - v = copyOfRange(originalValue, off, off+size);
1.8 + v = AbstractStringBuilder.copyOfRange(originalValue, off, off+size);
1.9 } else {
1.10 // The array representing the String is the same
1.11 // size as the String, so no point in making a copy.
1.12 @@ -188,7 +188,7 @@
1.13 int size = value.length;
1.14 this.offset = 0;
1.15 this.count = size;
1.16 - this.value = copyOf(value, size);
1.17 + this.value = AbstractStringBuilder.copyOf(value, size);
1.18 }
1.19
1.20 /**
1.21 @@ -225,7 +225,7 @@
1.22 }
1.23 this.offset = 0;
1.24 this.count = count;
1.25 - this.value = copyOfRange(value, offset, offset+count);
1.26 + this.value = AbstractStringBuilder.copyOfRange(value, offset, offset+count);
1.27 }
1.28
1.29 /**
1.30 @@ -818,7 +818,7 @@
1.31 * This method doesn't perform any range checking.
1.32 */
1.33 void getChars(char dst[], int dstBegin) {
1.34 - arraycopy(value, offset, dst, dstBegin, count);
1.35 + AbstractStringBuilder.arraycopy(value, offset, dst, dstBegin, count);
1.36 }
1.37
1.38 /**
1.39 @@ -861,7 +861,7 @@
1.40 if (srcBegin > srcEnd) {
1.41 throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
1.42 }
1.43 - arraycopy(value, offset + srcBegin, dst, dstBegin,
1.44 + AbstractStringBuilder.arraycopy(value, offset + srcBegin, dst, dstBegin,
1.45 srcEnd - srcBegin);
1.46 }
1.47
1.48 @@ -3034,32 +3034,4 @@
1.49 * guaranteed to be from a pool of unique strings.
1.50 */
1.51 public native String intern();
1.52 -
1.53 - static char[] copyOfRange(char[] original, int from, int to) {
1.54 - int newLength = to - from;
1.55 - if (newLength < 0) {
1.56 - throw new IllegalArgumentException(from + " > " + to);
1.57 - }
1.58 - char[] copy = new char[newLength];
1.59 - arraycopy(original, from, copy, 0,
1.60 - Math.min(original.length - from, newLength));
1.61 - return copy;
1.62 - }
1.63 - static char[] copyOf(char[] original, int newLength) {
1.64 - char[] copy = new char[newLength];
1.65 - arraycopy(original, 0, copy, 0,
1.66 - Math.min(original.length, newLength));
1.67 - return copy;
1.68 - }
1.69 - static void arraycopy(
1.70 - char[] value, int srcBegin, char[] dst, int dstBegin, int count
1.71 - ) {
1.72 - while (count-- > 0) {
1.73 - dst[dstBegin++] = value[srcBegin++];
1.74 - }
1.75 - }
1.76 - // access system property
1.77 - static String getProperty(String nm) {
1.78 - return null;
1.79 - }
1.80 }