jdk/src/java.base/share/classes/java/io/CharArrayWriter.java
changeset 32033 bf24e33c7919
parent 25859 3317bb8137f4
child 38373 21f4f5eee7cc
equal deleted inserted replaced
32032:22badc53802f 32033:bf24e33c7919
   139     }
   139     }
   140 
   140 
   141     /**
   141     /**
   142      * Appends the specified character sequence to this writer.
   142      * Appends the specified character sequence to this writer.
   143      *
   143      *
   144      * <p> An invocation of this method of the form <tt>out.append(csq)</tt>
   144      * <p> An invocation of this method of the form {@code out.append(csq)}
   145      * behaves in exactly the same way as the invocation
   145      * behaves in exactly the same way as the invocation
   146      *
   146      *
   147      * <pre>
   147      * <pre>
   148      *     out.write(csq.toString()) </pre>
   148      *     out.write(csq.toString()) </pre>
   149      *
   149      *
   150      * <p> Depending on the specification of <tt>toString</tt> for the
   150      * <p> Depending on the specification of {@code toString} for the
   151      * character sequence <tt>csq</tt>, the entire sequence may not be
   151      * character sequence {@code csq}, the entire sequence may not be
   152      * appended. For instance, invoking the <tt>toString</tt> method of a
   152      * appended. For instance, invoking the {@code toString} method of a
   153      * character buffer will return a subsequence whose content depends upon
   153      * character buffer will return a subsequence whose content depends upon
   154      * the buffer's position and limit.
   154      * the buffer's position and limit.
   155      *
   155      *
   156      * @param  csq
   156      * @param  csq
   157      *         The character sequence to append.  If <tt>csq</tt> is
   157      *         The character sequence to append.  If {@code csq} is
   158      *         <tt>null</tt>, then the four characters <tt>"null"</tt> are
   158      *         {@code null}, then the four characters "{@code null}" are
   159      *         appended to this writer.
   159      *         appended to this writer.
   160      *
   160      *
   161      * @return  This writer
   161      * @return  This writer
   162      *
   162      *
   163      * @since  1.5
   163      * @since  1.5
   169     }
   169     }
   170 
   170 
   171     /**
   171     /**
   172      * Appends a subsequence of the specified character sequence to this writer.
   172      * Appends a subsequence of the specified character sequence to this writer.
   173      *
   173      *
   174      * <p> An invocation of this method of the form <tt>out.append(csq, start,
   174      * <p> An invocation of this method of the form
   175      * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
   175      * {@code out.append(csq, start, end)} when
       
   176      * {@code csq} is not {@code null}, behaves in
   176      * exactly the same way as the invocation
   177      * exactly the same way as the invocation
   177      *
   178      *
   178      * <pre>
   179      * <pre>
   179      *     out.write(csq.subSequence(start, end).toString()) </pre>
   180      *     out.write(csq.subSequence(start, end).toString()) </pre>
   180      *
   181      *
   181      * @param  csq
   182      * @param  csq
   182      *         The character sequence from which a subsequence will be
   183      *         The character sequence from which a subsequence will be
   183      *         appended.  If <tt>csq</tt> is <tt>null</tt>, then characters
   184      *         appended.  If {@code csq} is {@code null}, then characters
   184      *         will be appended as if <tt>csq</tt> contained the four
   185      *         will be appended as if {@code csq} contained the four
   185      *         characters <tt>"null"</tt>.
   186      *         characters "{@code null}".
   186      *
   187      *
   187      * @param  start
   188      * @param  start
   188      *         The index of the first character in the subsequence
   189      *         The index of the first character in the subsequence
   189      *
   190      *
   190      * @param  end
   191      * @param  end
   192      *         subsequence
   193      *         subsequence
   193      *
   194      *
   194      * @return  This writer
   195      * @return  This writer
   195      *
   196      *
   196      * @throws  IndexOutOfBoundsException
   197      * @throws  IndexOutOfBoundsException
   197      *          If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
   198      *          If {@code start} or {@code end} are negative, {@code start}
   198      *          is greater than <tt>end</tt>, or <tt>end</tt> is greater than
   199      *          is greater than {@code end}, or {@code end} is greater than
   199      *          <tt>csq.length()</tt>
   200      *          {@code csq.length()}
   200      *
   201      *
   201      * @since  1.5
   202      * @since  1.5
   202      */
   203      */
   203     public CharArrayWriter append(CharSequence csq, int start, int end) {
   204     public CharArrayWriter append(CharSequence csq, int start, int end) {
   204         String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
   205         String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
   207     }
   208     }
   208 
   209 
   209     /**
   210     /**
   210      * Appends the specified character to this writer.
   211      * Appends the specified character to this writer.
   211      *
   212      *
   212      * <p> An invocation of this method of the form <tt>out.append(c)</tt>
   213      * <p> An invocation of this method of the form {@code out.append(c)}
   213      * behaves in exactly the same way as the invocation
   214      * behaves in exactly the same way as the invocation
   214      *
   215      *
   215      * <pre>
   216      * <pre>
   216      *     out.write(c) </pre>
   217      *     out.write(c) </pre>
   217      *
   218      *