< prev index next >

## src/java.base/share/classes/java/lang/StringBuilder.java

Print this page

    @@ -1,7 +1,7 @@
      /*
    -  * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
    +  * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
       * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       *
       * This code is free software; you can redistribute it and/or modify it
       * under the terms of the GNU General Public License version 2 only, as
       * published by the Free Software Foundation.  Oracle designates this

    @@ -25,10 +25,12 @@

      package java.lang;

      import jdk.internal.HotSpotIntrinsicCandidate;

    + import java.io.IOException;
    +
      /**
       * A mutable sequence of characters.  This class provides an API compatible
       * with {@code StringBuffer}, but with no guarantee of synchronization.
       * This class is designed for use as a drop-in replacement for
       * {@code StringBuffer} in places where the string buffer was being

    @@ -456,10 +458,13 @@
           *             builder ({@code int}), followed by the characters in the
           *             string builder ({@code char[]}).   The length of the
           *             {@code char} array may be greater than the number of
           *             characters currently stored in the string builder, in which
           *             case extra characters are ignored.
    +      *
    +      * @param  s the {@code ObjectOutputStream} to which data is written
    +      * @throws IOException if an I/O error occurs
           */
          @java.io.Serial
          private void writeObject(java.io.ObjectOutputStream s)
              throws java.io.IOException {
              s.defaultWriteObject();

    @@ -474,14 +479,18 @@
          }

          /**
           * readObject is called to restore the state of the StringBuffer from
           * a stream.
    +      *
    +      * @param  s the {@code ObjectInputStream} from which data is read
    +      * @throws IOException if an I/O error occurs
    +      * @throws ClassNotFoundException if a serialized class cannot be loaded
           */
          @java.io.Serial
          private void readObject(java.io.ObjectInputStream s)
    -         throws java.io.IOException, ClassNotFoundException {
    +         throws IOException, ClassNotFoundException {
              s.defaultReadObject();
              count = s.readInt();
              char[] val = (char[]) s.readObject();
              initBytes(val, 0, val.length);
          }

< prev index next >