< prev index next >

src/java.base/share/classes/java/io/StringWriter.java

Print this page

        

*** 28,40 **** /** * A character stream that collects its output in a string buffer, which can * then be used to construct a string. * <p> ! * Closing a <tt>StringWriter</tt> has no effect. The methods in this class * can be called after the stream has been closed without generating an ! * <tt>IOException</tt>. * * @author Mark Reinhold * @since 1.1 */ --- 28,40 ---- /** * A character stream that collects its output in a string buffer, which can * then be used to construct a string. * <p> ! * Closing a {@code StringWriter} has no effect. The methods in this class * can be called after the stream has been closed without generating an ! * {@code IOException}. * * @author Mark Reinhold * @since 1.1 */
*** 54,68 **** /** * Create a new string writer using the specified initial string-buffer * size. * * @param initialSize ! * The number of <tt>char</tt> values that will fit into this buffer * before it is automatically expanded * * @throws IllegalArgumentException ! * If <tt>initialSize</tt> is negative */ public StringWriter(int initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Negative buffer size"); } --- 54,68 ---- /** * Create a new string writer using the specified initial string-buffer * size. * * @param initialSize ! * The number of {@code char} values that will fit into this buffer * before it is automatically expanded * * @throws IllegalArgumentException ! * If {@code initialSize} is negative */ public StringWriter(int initialSize) { if (initialSize < 0) { throw new IllegalArgumentException("Negative buffer size"); }
*** 113,137 **** } /** * Appends the specified character sequence to this writer. * ! * <p> An invocation of this method of the form <tt>out.append(csq)</tt> * behaves in exactly the same way as the invocation * * <pre> * out.write(csq.toString()) </pre> * ! * <p> Depending on the specification of <tt>toString</tt> for the ! * character sequence <tt>csq</tt>, the entire sequence may not be ! * appended. For instance, invoking the <tt>toString</tt> method of a * character buffer will return a subsequence whose content depends upon * the buffer's position and limit. * * @param csq ! * The character sequence to append. If <tt>csq</tt> is ! * <tt>null</tt>, then the four characters <tt>"null"</tt> are * appended to this writer. * * @return This writer * * @since 1.5 --- 113,137 ---- } /** * Appends the specified character sequence to this writer. * ! * <p> An invocation of this method of the form {@code out.append(csq)} * behaves in exactly the same way as the invocation * * <pre> * out.write(csq.toString()) </pre> * ! * <p> Depending on the specification of {@code toString} for the ! * character sequence {@code csq}, the entire sequence may not be ! * appended. For instance, invoking the {@code toString} method of a * character buffer will return a subsequence whose content depends upon * the buffer's position and limit. * * @param csq ! * The character sequence to append. If {@code csq} is ! * {@code null}, then the four characters "{@code null}" are * appended to this writer. * * @return This writer * * @since 1.5
*** 145,166 **** } /** * Appends a subsequence of the specified character sequence to this writer. * ! * <p> An invocation of this method of the form <tt>out.append(csq, start, ! * end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in * exactly the same way as the invocation * ! * <pre> ! * out.write(csq.subSequence(start, end).toString()) </pre> * * @param csq * The character sequence from which a subsequence will be ! * appended. If <tt>csq</tt> is <tt>null</tt>, then characters ! * will be appended as if <tt>csq</tt> contained the four ! * characters <tt>"null"</tt>. * * @param start * The index of the first character in the subsequence * * @param end --- 145,168 ---- } /** * Appends a subsequence of the specified character sequence to this writer. * ! * <p> An invocation of this method of the form ! * {@code out.append(csq, start, end)} when {@code csq} ! * is not {@code null}, behaves in * exactly the same way as the invocation * ! * <pre>{@code ! * out.write(csq.subSequence(start, end).toString()) ! * }</pre> * * @param csq * The character sequence from which a subsequence will be ! * appended. If {@code csq} is {@code null}, then characters ! * will be appended as if {@code csq} contained the four ! * characters "{@code null}". * * @param start * The index of the first character in the subsequence * * @param end
*** 168,180 **** * subsequence * * @return This writer * * @throws IndexOutOfBoundsException ! * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt> ! * is greater than <tt>end</tt>, or <tt>end</tt> is greater than ! * <tt>csq.length()</tt> * * @since 1.5 */ public StringWriter append(CharSequence csq, int start, int end) { CharSequence cs = (csq == null ? "null" : csq); --- 170,182 ---- * subsequence * * @return This writer * * @throws IndexOutOfBoundsException ! * If {@code start} or {@code end} are negative, {@code start} ! * is greater than {@code end}, or {@code end} is greater than ! * {@code csq.length()} * * @since 1.5 */ public StringWriter append(CharSequence csq, int start, int end) { CharSequence cs = (csq == null ? "null" : csq);
*** 183,193 **** } /** * Appends the specified character to this writer. * ! * <p> An invocation of this method of the form <tt>out.append(c)</tt> * behaves in exactly the same way as the invocation * * <pre> * out.write(c) </pre> * --- 185,195 ---- } /** * Appends the specified character to this writer. * ! * <p> An invocation of this method of the form {@code out.append(c)} * behaves in exactly the same way as the invocation * * <pre> * out.write(c) </pre> *
*** 224,236 **** */ public void flush() { } /** ! * Closing a <tt>StringWriter</tt> has no effect. The methods in this * class can be called after the stream has been closed without generating ! * an <tt>IOException</tt>. */ public void close() throws IOException { } } --- 226,238 ---- */ public void flush() { } /** ! * Closing a {@code StringWriter} has no effect. The methods in this * class can be called after the stream has been closed without generating ! * an {@code IOException}. */ public void close() throws IOException { } }
< prev index next >