< prev index next >

src/java.base/share/classes/java/lang/AbstractStringBuilder.java

Print this page

        

@@ -175,11 +175,11 @@
     private void inflate() {
         if (!isLatin1()) {
             return;
         }
         byte[] buf = StringUTF16.newBytesFor(value.length);
-        StringLatin1.inflateSB(value, buf, 0, count);
+        StringLatin1.inflate(value, 0, buf, 0, count);
         this.value = buf;
         this.coder = UTF16;
     }
 
     /**

@@ -412,13 +412,13 @@
     {
         checkRangeSIOOBE(srcBegin, srcEnd, count);  // compatible to old version
         int n = srcEnd - srcBegin;
         checkRange(dstBegin, dstBegin + n, dst.length);
         if (isLatin1()) {
-            StringLatin1.getCharsSB(value, srcBegin, srcEnd, dst, dstBegin);
+            StringLatin1.getChars(value, srcBegin, srcEnd, dst, dstBegin);
         } else {
-            StringUTF16.getCharsSB(value, srcBegin, srcEnd, dst, dstBegin);
+            StringUTF16.getChars(value, srcBegin, srcEnd, dst, dstBegin);
         }
     }
 
     /**
      * The character at the specified index is set to {@code ch}. This

@@ -990,11 +990,11 @@
     public String substring(int start, int end) {
         checkRangeSIOOBE(start, end, count);
         if (isLatin1()) {
             return StringLatin1.newString(value, start, end - start);
         }
-        return StringUTF16.newStringSB(value, start, end - start);
+        return StringUTF16.newString(value, start, end - start);
     }
 
     private void shift(int offset, int n) {
         System.arraycopy(value, offset << coder,
                          value, (offset + n) << coder, (count - offset) << coder);

@@ -1586,11 +1586,11 @@
      */
     protected void getBytes(byte dst[], int dstBegin, byte coder) {
         if (this.coder == coder) {
             System.arraycopy(value, 0, dst, dstBegin << coder, count << coder);
         } else {        // this.coder == LATIN && coder == UTF16
-            StringLatin1.inflateSB(value, dst, dstBegin, count);
+            StringLatin1.inflate(value, 0, dst, dstBegin, count);
         }
     }
 
     /* for readObject() */
     protected void initBytes(char[] value, int off, int len) {

@@ -1651,14 +1651,11 @@
 
     private final void putStringAt(int index, String str) {
         if (getCoder() != str.coder()) {
             inflate();
         }
-        byte[] val = this.value;
-        byte coder = this.coder;
-        checkOffset(index + str.length(), val.length >> coder);
-        str.getBytes(val, index, coder);
+        str.getBytes(value, index, coder);
     }
 
     private final void appendChars(char[] s, int off, int end) {
         if (isLatin1()) {
             byte[] val = this.value;
< prev index next >