/[classpath]/classpath/java/lang/StringBuilder.java
ViewVC logotype

Diff of /classpath/java/lang/StringBuilder.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mark, Sat Jul 2 20:32:39 2005 UTC revision 1.6 by tromey, Mon Oct 24 23:58:21 2005 UTC
# Line 464  public final class StringBuilder Line 464  public final class StringBuilder
464    }    }
465    
466    /**    /**
467       * Append the code point to this <code>StringBuilder</code>.
468       * This is like #append(char), but will append two characters
469       * if a supplementary code point is given.
470       *
471       * @param code the code point to append
472       * @return this <code>StringBuilder</code>
473       * @see Character#toChars(int, char[], int)
474       * @since 1.5
475       */
476      public synchronized StringBuilder appendCodePoint(int code)
477      {
478        int len = Character.charCount(code);
479        ensureCapacity(count + len);
480        Character.toChars(code, value, count);
481        count += len;
482        return this;
483      }
484    
485      /**
486     * Append the <code>String</code> value of the argument to this     * Append the <code>String</code> value of the argument to this
487     * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert     * <code>StringBuilder</code>. Uses <code>String.valueOf()</code> to convert
488     * to <code>String</code>.     * to <code>String</code>.
# Line 703  public final class StringBuilder Line 722  public final class StringBuilder
722      count += len;      count += len;
723      return this;      return this;
724    }    }
725    
726      /**
727       * Insert the <code>CharSequence</code> argument into this
728       * <code>StringBuilder</code>.  If the sequence is null, the String
729       * "null" is used instead.
730       *
731       * @param offset the place to insert in this buffer
732       * @param sequence the <code>CharSequence</code> to insert
733       * @return this <code>StringBuilder</code>
734       * @throws IndexOutOfBoundsException if offset is out of bounds
735       */
736      public synchronized StringBuilder insert(int offset, CharSequence sequence)
737      {
738        if (sequence == null)
739          sequence = "null";
740        return insert(offset, sequence, 0, sequence.length());
741      }
742    
743      /**
744       * Insert a subsequence of the <code>CharSequence</code> argument into this
745       * <code>StringBuilder</code>.  If the sequence is null, the String
746       * "null" is used instead.
747       *
748       * @param offset the place to insert in this buffer
749       * @param sequence the <code>CharSequence</code> to insert
750       * @param start the starting index of the subsequence
751       * @param end one past the ending index of the subsequence
752       * @return this <code>StringBuilder</code>
753       * @throws IndexOutOfBoundsException if offset, start,
754       * or end are out of bounds
755       */
756      public synchronized StringBuilder insert(int offset, CharSequence sequence,
757                          int start, int end)
758      {
759        if (sequence == null)
760          sequence = "null";
761        if (start < 0 || end < 0 || start > end || end > sequence.length())
762          throw new IndexOutOfBoundsException();
763        int len = end - start;
764        ensureCapacity(count + len);
765        VMSystem.arraycopy(value, offset, value, offset + len, count - offset);
766        for (int i = start; i < end; ++i)
767          value[offset++] = sequence.charAt(i);
768        count += len;
769        return this;
770      }
771    
772    /**    /**
773     * Insert the <code>char[]</code> argument into this     * Insert the <code>char[]</code> argument into this

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26