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

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

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