jdk/src/share/classes/java/lang/StringBuilder.java
author rriggs
Sat, 01 Mar 2014 11:57:57 -0500
changeset 23040 0cb50d5761df
parent 23010 6dadb192ad81
permissions -rw-r--r--
8035813: Broken link in java.lang.Iterable Summary: Fixed link to ../util/ Reviewed-by: lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 15312
diff changeset
     2
 * Copyright (c) 2003, 2013, 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 mutable sequence of characters.  This class provides an API compatible
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    31
 * with {@code StringBuffer}, but with no guarantee of synchronization.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * This class is designed for use as a drop-in replacement for
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    33
 * {@code StringBuffer} in places where the string buffer was being
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * used by a single thread (as is generally the case).   Where possible,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * it is recommended that this class be used in preference to
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    36
 * {@code StringBuffer} as it will be faster under most implementations.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    38
 * <p>The principal operations on a {@code StringBuilder} are the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    39
 * {@code append} and {@code insert} methods, which are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * overloaded so as to accept data of any type. Each effectively
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * converts a given datum to a string and then appends or inserts the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * characters of that string to the string builder. The
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    43
 * {@code append} method always adds these characters at the end
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    44
 * of the builder; the {@code insert} method adds the characters at
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * a specified point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    47
 * For example, if {@code z} refers to a string builder object
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    48
 * whose current contents are "{@code start}", then
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    49
 * the method call {@code z.append("le")} would cause the string
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    50
 * builder to contain "{@code startle}", whereas
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    51
 * {@code z.insert(4, "le")} would alter the string builder to
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    52
 * contain "{@code starlet}".
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <p>
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    54
 * In general, if sb refers to an instance of a {@code StringBuilder},
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    55
 * then {@code sb.append(x)} has the same effect as
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    56
 * {@code sb.insert(sb.length(), x)}.
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    57
 * <p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * Every string builder has a capacity. As long as the length of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * character sequence contained in the string builder does not exceed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * the capacity, it is not necessary to allocate a new internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * buffer. If the internal buffer overflows, it is automatically made larger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    63
 * <p>Instances of {@code StringBuilder} are not safe for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * use by multiple threads. If such synchronization is required then it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * recommended that {@link java.lang.StringBuffer} be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *
15312
4b57f9da8192 4247235: (spec str) StringBuffer.insert(int, char[]) specification is inconsistent
jgish
parents: 14997
diff changeset
    67
 * <p>Unless otherwise noted, passing a {@code null} argument to a constructor
4b57f9da8192 4247235: (spec str) StringBuffer.insert(int, char[]) specification is inconsistent
jgish
parents: 14997
diff changeset
    68
 * or method in this class will cause a {@link NullPointerException} to be
4b57f9da8192 4247235: (spec str) StringBuffer.insert(int, char[]) specification is inconsistent
jgish
parents: 14997
diff changeset
    69
 * thrown.
4b57f9da8192 4247235: (spec str) StringBuffer.insert(int, char[]) specification is inconsistent
jgish
parents: 14997
diff changeset
    70
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * @author      Michael McCloskey
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * @see         java.lang.StringBuffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * @see         java.lang.String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * @since       1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
public final class StringBuilder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    extends AbstractStringBuilder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    implements java.io.Serializable, CharSequence
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /** use serialVersionUID for interoperability */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    static final long serialVersionUID = 4383685877147921099L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * Constructs a string builder with no characters in it and an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * initial capacity of 16 characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public StringBuilder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        super(16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Constructs a string builder with no characters in it and an
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    94
     * initial capacity specified by the {@code capacity} argument.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @param      capacity  the initial capacity.
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    97
     * @throws     NegativeArraySizeException  if the {@code capacity}
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
    98
     *               argument is less than {@code 0}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    public StringBuilder(int capacity) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        super(capacity);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * Constructs a string builder initialized to the contents of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * specified string. The initial capacity of the string builder is
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   107
     * {@code 16} plus the length of the string argument.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @param   str   the initial contents of the buffer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public StringBuilder(String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        super(str.length() + 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Constructs a string builder that contains the same characters
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   118
     * as the specified {@code CharSequence}. The initial capacity of
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   119
     * the string builder is {@code 16} plus the length of the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   120
     * {@code CharSequence} argument.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @param      seq   the sequence to copy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public StringBuilder(CharSequence seq) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        this(seq.length() + 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        append(seq);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   129
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public StringBuilder append(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        return append(String.valueOf(obj));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   134
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    public StringBuilder append(String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        super.append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   141
     * Appends the specified {@code StringBuffer} to this sequence.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * <p>
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   143
     * The characters of the {@code StringBuffer} argument are appended,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * in order, to this sequence, increasing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * length of this sequence by the length of the argument.
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   146
     * If {@code sb} is {@code null}, then the four characters
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   147
     * {@code "null"} are appended to this sequence.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Let <i>n</i> be the length of this character sequence just prior to
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   150
     * execution of the {@code append} method. Then the character at index
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * <i>k</i> in the new character sequence is equal to the character at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * index <i>k</i> in the old character sequence, if <i>k</i> is less than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * <i>n</i>; otherwise, it is equal to the character at index <i>k-n</i>
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   154
     * in the argument {@code sb}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     *
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   156
     * @param   sb   the {@code StringBuffer} to append.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @return  a reference to this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    public StringBuilder append(StringBuffer sb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        super.append(sb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   164
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    public StringBuilder append(CharSequence s) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   166
        super.append(s);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   167
        return this;
2
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
     * @throws     IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   173
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    public StringBuilder append(CharSequence s, int start, int end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        super.append(s, start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   179
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   180
    public StringBuilder append(char[] str) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        super.append(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   185
    /**
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   186
     * @throws IndexOutOfBoundsException {@inheritDoc}
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   187
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   188
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   189
    public StringBuilder append(char[] str, int offset, int len) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        super.append(str, offset, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   194
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public StringBuilder append(boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        super.append(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   200
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public StringBuilder append(char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        super.append(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   206
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public StringBuilder append(int i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        super.append(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   212
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public StringBuilder append(long lng) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        super.append(lng);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   218
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    public StringBuilder append(float f) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        super.append(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   224
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    public StringBuilder append(double d) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        super.append(d);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return this;
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
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   233
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public StringBuilder appendCodePoint(int codePoint) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        super.appendCodePoint(codePoint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   242
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    public StringBuilder delete(int start, int end) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        super.delete(start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   251
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    public StringBuilder deleteCharAt(int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        super.deleteCharAt(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   260
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    public StringBuilder replace(int start, int end, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        super.replace(start, end, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   269
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   270
    public StringBuilder insert(int index, char[] str, int offset,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                                int len)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        super.insert(index, str, offset, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   280
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    public StringBuilder insert(int offset, Object obj) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   282
            super.insert(offset, obj);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   283
            return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   289
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    public StringBuilder insert(int offset, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        super.insert(offset, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   298
    @Override
1223
5c1037124466 6728229: (str) StringBuilder.append(CharSequence) does not throw IndexOutOfBoundsException
martin
parents: 2
diff changeset
   299
    public StringBuilder insert(int offset, char[] str) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        super.insert(offset, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   307
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public StringBuilder insert(int dstOffset, CharSequence s) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   309
            super.insert(dstOffset, s);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   310
            return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   316
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    public StringBuilder insert(int dstOffset, CharSequence s,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                                int start, int end)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        super.insert(dstOffset, s, start, end);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   327
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public StringBuilder insert(int offset, boolean b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        super.insert(offset, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * @throws IndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   336
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    public StringBuilder insert(int offset, char c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        super.insert(offset, c);
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   345
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    public StringBuilder insert(int offset, int i) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   347
        super.insert(offset, i);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   348
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   354
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public StringBuilder insert(int offset, long l) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   356
        super.insert(offset, l);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   357
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   363
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    public StringBuilder insert(int offset, float f) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   365
        super.insert(offset, f);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   366
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @throws StringIndexOutOfBoundsException {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   372
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    public StringBuilder insert(int offset, double d) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   374
        super.insert(offset, d);
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   375
        return this;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   378
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public int indexOf(String str) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   380
        return super.indexOf(str);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   383
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public int indexOf(String str, int fromIndex) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   385
        return super.indexOf(str, fromIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   388
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    public int lastIndexOf(String str) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   390
        return super.lastIndexOf(str);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   393
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    public int lastIndexOf(String str, int fromIndex) {
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   395
        return super.lastIndexOf(str, fromIndex);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   398
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    public StringBuilder reverse() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        super.reverse();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
14332
451c5dd717dc 6206780: (str) Forwarding append methods in String{Buffer,Builder} are inconsistent
jgish
parents: 5506
diff changeset
   404
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        // Create a copy, don't share the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        return new String(value, 0, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    /**
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   411
     * Save the state of the {@code StringBuilder} instance to a stream
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * (that is, serialize it).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @serialData the number of characters currently stored in the string
14997
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   415
     *             builder ({@code int}), followed by the characters in the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   416
     *             string builder ({@code char[]}).   The length of the
97d6098fd419 8005118: Javadoc styles are inconsistent
jgish
parents: 14342
diff changeset
   417
     *             {@code char} array may be greater than the number of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     *             characters currently stored in the string builder, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *             case extra characters are ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    private void writeObject(java.io.ObjectOutputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        throws java.io.IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        s.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        s.writeInt(count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        s.writeObject(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * readObject is called to restore the state of the StringBuffer from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * a stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    private void readObject(java.io.ObjectInputStream s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        throws java.io.IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        s.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        count = s.readInt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        value = (char[]) s.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
}