jdk/src/share/classes/java/lang/StringBuffer.java
author jgish
Fri, 28 Dec 2012 16:56:54 -0500
changeset 14997 97d6098fd419
parent 14332 451c5dd717dc
child 15312 4b57f9da8192
permissions -rw-r--r--
8005118: Javadoc styles are inconsistent Summary: use a common javadoc style in the String classes Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
     2
 * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * A thread-safe, mutable sequence of characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * A string buffer is like a {@link String}, but can be modified. At any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * point in time it contains some particular sequence of characters, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * the length and content of the sequence can be changed through certain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * method calls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * String buffers are safe for use by multiple threads. The methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * are synchronized where necessary so that all the operations on any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * particular instance behave as if they occur in some serial order
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * that is consistent with the order of the method calls made by each of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * the individual threads involved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    42
 * The principal operations on a {@code StringBuffer} are the
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    43
 * {@code append} and {@code insert} methods, which are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * overloaded so as to accept data of any type. Each effectively
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * converts a given datum to a string and then appends or inserts the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * characters of that string to the string buffer. The
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    47
 * {@code append} method always adds these characters at the end
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    48
 * of the buffer; the {@code insert} method adds the characters at
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * a specified point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    51
 * For example, if {@code z} refers to a string buffer object
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    52
 * whose current contents are {@code "start"}, then
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    53
 * the method call {@code z.append("le")} would cause the string
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    54
 * buffer to contain {@code "startle"}, whereas
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    55
 * {@code z.insert(4, "le")} would alter the string buffer to
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    56
 * contain {@code "starlet"}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    58
 * In general, if sb refers to an instance of a {@code StringBuffer},
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    59
 * then {@code sb.append(x)} has the same effect as
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
    60
 * {@code sb.insert(sb.length(), x)}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * Whenever an operation occurs involving a source sequence (such as
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    63
 * appending or inserting from a source sequence), this class synchronizes
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * only on the string buffer performing the operation, not on the source.
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    65
 * Note that while {@code StringBuffer} is designed to be safe to use
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    66
 * concurrently from multiple threads, if the constructor or the
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    67
 * {@code append} or {@code insert} operation is passed a source sequence
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    68
 * that is shared across threads, the calling code must ensure
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    69
 * that the operation has a consistent and unchanging view of the source
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    70
 * sequence for the duration of the operation.
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    71
 * This could be satisfied by the caller holding a lock during the
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    72
 * operation's call, by using an immutable source sequence, or by not
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
    73
 * sharing the source sequence across threads.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * Every string buffer has a capacity. As long as the length of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * character sequence contained in the string buffer does not exceed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * the capacity, it is not necessary to allocate a new internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * buffer array. If the internal buffer overflows, it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * automatically made larger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * As of  release JDK 5, this class has been supplemented with an equivalent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * class designed for use by a single thread, {@link StringBuilder}.  The
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
    83
 * {@code StringBuilder} class should generally be used in preference to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * this one, as it supports all of the same operations but it is faster, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * it performs no synchronization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * @author      Arthur van Hoff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * @see     java.lang.StringBuilder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * @see     java.lang.String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * @since   JDK1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 public final class StringBuffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    extends AbstractStringBuilder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    implements java.io.Serializable, CharSequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /** use serialVersionUID from JDK 1.0.2 for interoperability */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    static final long serialVersionUID = 3388685877147921107L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Constructs a string buffer with no characters in it and an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * initial capacity of 16 characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public StringBuffer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        super(16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Constructs a string buffer with no characters in it and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * the specified initial capacity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @param      capacity  the initial capacity.
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   113
     * @exception  NegativeArraySizeException  if the {@code capacity}
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   114
     *               argument is less than {@code 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public StringBuffer(int capacity) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        super(capacity);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Constructs a string buffer initialized to the contents of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * specified string. The initial capacity of the string buffer is
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   123
     * {@code 16} plus the length of the string argument.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @param   str   the initial contents of the buffer.
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   126
     * @exception NullPointerException if {@code str} is {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public StringBuffer(String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        super(str.length() + 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Constructs a string buffer that contains the same characters
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   135
     * as the specified {@code CharSequence}. The initial capacity of
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   136
     * the string buffer is {@code 16} plus the length of the
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   137
     * {@code CharSequence} argument.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   139
     * If the length of the specified {@code CharSequence} is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * less than or equal to zero, then an empty buffer of capacity
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   141
     * {@code 16} is returned.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @param      seq   the sequence to copy.
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   144
     * @exception NullPointerException if {@code seq} is {@code null}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    public StringBuffer(CharSequence seq) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        this(seq.length() + 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        append(seq);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   152
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public synchronized int length() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   157
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public synchronized int capacity() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        return value.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   163
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    public synchronized void ensureCapacity(int minimumCapacity) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        if (minimumCapacity > value.length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            expandCapacity(minimumCapacity);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @since      1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   173
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    public synchronized void trimToSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        super.trimToSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @see        #length()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   182
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    public synchronized void setLength(int newLength) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        super.setLength(newLength);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @see        #length()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   191
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    public synchronized char charAt(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        if ((index < 0) || (index >= count))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            throw new StringIndexOutOfBoundsException(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return value[index];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @since      1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   201
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public synchronized int codePointAt(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return super.codePointAt(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @since     1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   209
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    public synchronized int codePointBefore(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        return super.codePointBefore(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @since     1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   217
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public synchronized int codePointCount(int beginIndex, int endIndex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        return super.codePointCount(beginIndex, endIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @since     1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   225
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public synchronized int offsetByCodePoints(int index, int codePointOffset) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return super.offsetByCodePoints(index, codePointOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   234
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   235
    public synchronized void getChars(int srcBegin, int srcEnd, char[] dst,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                                      int dstBegin)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        super.getChars(srcBegin, srcEnd, dst, dstBegin);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @see        #length()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   245
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public synchronized void setCharAt(int index, char ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if ((index < 0) || (index >= count))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            throw new StringIndexOutOfBoundsException(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        value[index] = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   252
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    public synchronized StringBuffer append(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        super.append(String.valueOf(obj));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   258
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public synchronized StringBuffer append(String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        super.append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   265
     * Appends the specified {@code StringBuffer} to this sequence.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * <p>
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   267
     * The characters of the {@code StringBuffer} argument are appended,
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   268
     * in order, to the contents of this {@code StringBuffer}, increasing the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   269
     * length of this {@code StringBuffer} by the length of the argument.
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   270
     * If {@code sb} is {@code null}, then the four characters
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   271
     * {@code "null"} are appended to this {@code StringBuffer}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * Let <i>n</i> be the length of the old character sequence, the one
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   274
     * contained in the {@code StringBuffer} just prior to execution of the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   275
     * {@code append} method. Then the character at index <i>k</i> in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * the new character sequence is equal to the character at index <i>k</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * in the old character sequence, if <i>k</i> is less than <i>n</i>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * otherwise, it is equal to the character at index <i>k-n</i> in the
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   279
     * argument {@code sb}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   281
     * This method synchronizes on {@code this}, the destination
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   282
     * object, but does not synchronize on the source ({@code sb}).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14332
diff changeset
   284
     * @param   sb   the {@code StringBuffer} to append.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @return  a reference to this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public synchronized StringBuffer append(StringBuffer sb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        super.append(sb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   293
    /**
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   294
     * @since 1.8
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   295
     */
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   296
    @Override
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   297
    synchronized StringBuffer append(AbstractStringBuilder asb) {
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   298
        super.append(asb);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   299
        return this;
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   300
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /**
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   303
     * Appends the specified {@code CharSequence} to this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * <p>
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   306
     * The characters of the {@code CharSequence} argument are appended,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * in order, increasing the length of this sequence by the length of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * <p>The result of this method is exactly the same as if it were an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * invocation of this.append(s, 0, s.length());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   313
     * <p>This method synchronizes on {@code this}, the destination
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   314
     * object, but does not synchronize on the source ({@code s}).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   316
     * <p>If {@code s} is {@code null}, then the four characters
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   317
     * {@code "null"} are appended.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
13155
8140afb39557 7100996: (spec str) IndexOutOfBoundsException when using a StringBuffer from multiple threads
jgish
parents: 5506
diff changeset
   319
     * @param   s the {@code CharSequence} to append.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @return  a reference to this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   323
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    public StringBuffer append(CharSequence s) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   325
        // Note, synchronization achieved via invocations of other StringBuffer methods after
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   326
        // narrowing of s to specific type
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   327
        super.append(s);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   328
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @since      1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   335
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    public synchronized StringBuffer append(CharSequence s, int start, int end)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        super.append(s, start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   342
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   343
    public synchronized StringBuffer append(char[] str) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        super.append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   348
    /**
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   349
     * @throws IndexOutOfBoundsException {@inheritDoc}
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   350
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   351
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   352
    public synchronized StringBuffer append(char[] str, int offset, int len) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        super.append(str, offset, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   357
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    public synchronized StringBuffer append(boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        super.append(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   363
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    public synchronized StringBuffer append(char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        super.append(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   369
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    public synchronized StringBuffer append(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        super.append(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   378
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public synchronized StringBuffer appendCodePoint(int codePoint) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        super.appendCodePoint(codePoint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   384
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    public synchronized StringBuffer append(long lng) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        super.append(lng);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   390
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    public synchronized StringBuffer append(float f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        super.append(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   396
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    public synchronized StringBuffer append(double d) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        super.append(d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   406
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    public synchronized StringBuffer delete(int start, int end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        super.delete(start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   416
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    public synchronized StringBuffer deleteCharAt(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        super.deleteCharAt(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   426
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    public synchronized StringBuffer replace(int start, int end, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        super.replace(start, end, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   436
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    public synchronized String substring(int start) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        return substring(start, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @since      1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   445
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    public synchronized CharSequence subSequence(int start, int end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        return super.substring(start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   454
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    public synchronized String substring(int start, int end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        return super.substring(start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @since      1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   463
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   464
    public synchronized StringBuffer insert(int index, char[] str, int offset,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                                            int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        super.insert(index, str, offset, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   474
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    public synchronized StringBuffer insert(int offset, Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        super.insert(offset, String.valueOf(obj));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   483
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    public synchronized StringBuffer insert(int offset, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        super.insert(offset, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   492
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   493
    public synchronized StringBuffer insert(int offset, char[] str) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        super.insert(offset, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @since      1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   502
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    public StringBuffer insert(int dstOffset, CharSequence s) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   504
        // Note, synchronization achieved via invocations of other StringBuffer methods
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   505
        // after narrowing of s to specific type
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   506
        super.insert(dstOffset, s);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   507
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * @since      1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   514
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    public synchronized StringBuffer insert(int dstOffset, CharSequence s,
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   516
            int start, int end)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        super.insert(dstOffset, s, start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   525
    @Override
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   526
    public  StringBuffer insert(int offset, boolean b) {
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   527
        // Note, synchronization achieved via invocation of StringBuffer insert(int, String)
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   528
        // after conversion of b to String by super class method
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   529
        super.insert(offset, b);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   530
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   536
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    public synchronized StringBuffer insert(int offset, char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        super.insert(offset, c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   545
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    public StringBuffer insert(int offset, int i) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   547
        // Note, synchronization achieved via invocation of StringBuffer insert(int, String)
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   548
        // after conversion of i to String by super class method
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   549
        super.insert(offset, i);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   550
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   556
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    public StringBuffer insert(int offset, long l) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   558
        // Note, synchronization achieved via invocation of StringBuffer insert(int, String)
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   559
        // after conversion of l to String by super class method
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   560
        super.insert(offset, l);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   561
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   567
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    public StringBuffer insert(int offset, float f) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   569
        // Note, synchronization achieved via invocation of StringBuffer insert(int, String)
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   570
        // after conversion of f to String by super class method
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   571
        super.insert(offset, f);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   572
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   578
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    public StringBuffer insert(int offset, double d) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   580
        // Note, synchronization achieved via invocation of StringBuffer insert(int, String)
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   581
        // after conversion of d to String by super class method
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   582
        super.insert(offset, d);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   583
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * @since      1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   590
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    public int indexOf(String str) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   592
        // Note, synchronization achieved via invocations of other StringBuffer methods
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   593
        return super.indexOf(str);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * @since      1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   600
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    public synchronized int indexOf(String str, int fromIndex) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   602
        return super.indexOf(str, fromIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * @since      1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   609
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    public int lastIndexOf(String str) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   611
        // Note, synchronization achieved via invocations of other StringBuffer methods
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
        return lastIndexOf(str, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * @throws NullPointerException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * @since      1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   619
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    public synchronized int lastIndexOf(String str, int fromIndex) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   621
        return super.lastIndexOf(str, fromIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * @since   JDK1.0.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   627
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    public synchronized StringBuffer reverse() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        super.reverse();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 13155
diff changeset
   633
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
    public synchronized String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        return new String(value, 0, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * Serializable fields for StringBuffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * @serialField value  char[]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     *              The backing character array of this StringBuffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * @serialField count int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     *              The number of characters in this StringBuffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * @serialField shared  boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     *              A flag indicating whether the backing array is shared.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     *              The value is ignored upon deserialization.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    private static final java.io.ObjectStreamField[] serialPersistentFields =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
        new java.io.ObjectStreamField("value", char[].class),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        new java.io.ObjectStreamField("count", Integer.TYPE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        new java.io.ObjectStreamField("shared", Boolean.TYPE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     * readObject is called to restore the state of the StringBuffer from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * a stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    private synchronized void writeObject(java.io.ObjectOutputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
        throws java.io.IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
        java.io.ObjectOutputStream.PutField fields = s.putFields();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
        fields.put("value", value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
        fields.put("count", count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
        fields.put("shared", false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
        s.writeFields();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * readObject is called to restore the state of the StringBuffer from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * a stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    private void readObject(java.io.ObjectInputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
        throws java.io.IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
        java.io.ObjectInputStream.GetField fields = s.readFields();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
        value = (char[])fields.get("value", null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
        count = fields.get("count", 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
}