< prev index next >

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

Print this page

        

*** 30,52 **** import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; /** ! * A <code>PrintStream</code> adds functionality to another output stream, * namely the ability to print representations of various data values * conveniently. Two other features are provided as well. Unlike other output ! * streams, a <code>PrintStream</code> never throws an ! * <code>IOException</code>; instead, exceptional situations merely set an ! * internal flag that can be tested via the <code>checkError</code> method. ! * Optionally, a <code>PrintStream</code> can be created so as to flush ! * automatically; this means that the <code>flush</code> method is * automatically invoked after a byte array is written, one of the ! * <code>println</code> methods is invoked, or a newline character or byte ! * (<code>'\n'</code>) is written. * ! * <p> All characters printed by a <code>PrintStream</code> are converted into * bytes using the platform's default character encoding. The <code>{@link * PrintWriter}</code> class should be used in situations that require writing * characters rather than bytes. * * @author Frank Yellin --- 30,52 ---- import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; /** ! * A {@code PrintStream} adds functionality to another output stream, * namely the ability to print representations of various data values * conveniently. Two other features are provided as well. Unlike other output ! * streams, a {@code PrintStream} never throws an ! * {@code IOException}; instead, exceptional situations merely set an ! * internal flag that can be tested via the {@code checkError} method. ! * Optionally, a {@code PrintStream} can be created so as to flush ! * automatically; this means that the {@code flush} method is * automatically invoked after a byte array is written, one of the ! * {@code println} methods is invoked, or a newline character or byte ! * ({@code '\n'}) is written. * ! * <p> All characters printed by a {@code PrintStream} are converted into * bytes using the platform's default character encoding. The <code>{@link * PrintWriter}</code> class should be used in situations that require writing * characters rather than bytes. * * @author Frank Yellin
*** 140,151 **** * * @param out The output stream to which values and objects will be * printed * @param autoFlush A boolean; if true, the output buffer will be flushed * whenever a byte array is written, one of the ! * <code>println</code> methods is invoked, or a newline ! * character or byte (<code>'\n'</code>) is written * * @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean) */ public PrintStream(OutputStream out, boolean autoFlush) { this(autoFlush, requireNonNull(out, "Null output stream")); --- 140,151 ---- * * @param out The output stream to which values and objects will be * printed * @param autoFlush A boolean; if true, the output buffer will be flushed * whenever a byte array is written, one of the ! * {@code println} methods is invoked, or a newline ! * character or byte ({@code '\n'}) is written * * @see java.io.PrintWriter#PrintWriter(java.io.OutputStream, boolean) */ public PrintStream(OutputStream out, boolean autoFlush) { this(autoFlush, requireNonNull(out, "Null output stream"));
*** 156,167 **** * * @param out The output stream to which values and objects will be * printed * @param autoFlush A boolean; if true, the output buffer will be flushed * whenever a byte array is written, one of the ! * <code>println</code> methods is invoked, or a newline ! * character or byte (<code>'\n'</code>) is written * @param encoding The name of a supported * <a href="../lang/package-summary.html#charenc"> * character encoding</a> * * @throws UnsupportedEncodingException --- 156,167 ---- * * @param out The output stream to which values and objects will be * printed * @param autoFlush A boolean; if true, the output buffer will be flushed * whenever a byte array is written, one of the ! * {@code println} methods is invoked, or a newline ! * character or byte ({@code '\n'}) is written * @param encoding The name of a supported * <a href="../lang/package-summary.html#charenc"> * character encoding</a> * * @throws UnsupportedEncodingException
*** 369,393 **** } } /** * Flushes the stream and checks its error state. The internal error state ! * is set to <code>true</code> when the underlying output stream throws an ! * <code>IOException</code> other than <code>InterruptedIOException</code>, ! * and when the <code>setError</code> method is invoked. If an operation * on the underlying output stream throws an ! * <code>InterruptedIOException</code>, then the <code>PrintStream</code> * converts the exception back into an interrupt by doing: ! * <pre> * Thread.currentThread().interrupt(); ! * </pre> * or the equivalent. * ! * @return <code>true</code> if and only if this stream has encountered an ! * <code>IOException</code> other than ! * <code>InterruptedIOException</code>, or the ! * <code>setError</code> method has been invoked */ public boolean checkError() { if (out != null) flush(); if (out instanceof java.io.PrintStream) { --- 369,393 ---- } } /** * Flushes the stream and checks its error state. The internal error state ! * is set to {@code true} when the underlying output stream throws an ! * {@code IOException} other than {@code InterruptedIOException}, ! * and when the {@code setError} method is invoked. If an operation * on the underlying output stream throws an ! * {@code InterruptedIOException}, then the {@code PrintStream} * converts the exception back into an interrupt by doing: ! * <pre>{@code * Thread.currentThread().interrupt(); ! * }</pre> * or the equivalent. * ! * @return {@code true} if and only if this stream has encountered an ! * {@code IOException} other than ! * {@code InterruptedIOException}, or the ! * {@code setError} method has been invoked */ public boolean checkError() { if (out != null) flush(); if (out instanceof java.io.PrintStream) {
*** 396,410 **** } return trouble; } /** ! * Sets the error state of the stream to <code>true</code>. * * <p> This method will cause subsequent invocations of {@link ! * #checkError()} to return <tt>true</tt> until {@link ! * #clearError()} is invoked. * * @since 1.1 */ protected void setError() { trouble = true; --- 396,410 ---- } return trouble; } /** ! * Sets the error state of the stream to {@code true}. * * <p> This method will cause subsequent invocations of {@link ! * #checkError()} to return {@code true} until ! * {@link #clearError()} is invoked. * * @since 1.1 */ protected void setError() { trouble = true;
*** 412,422 **** /** * Clears the internal error state of this stream. * * <p> This method will cause subsequent invocations of {@link ! * #checkError()} to return <tt>false</tt> until another write * operation fails and invokes {@link #setError()}. * * @since 1.6 */ protected void clearError() { --- 412,422 ---- /** * Clears the internal error state of this stream. * * <p> This method will cause subsequent invocations of {@link ! * #checkError()} to return {@code false} until another write * operation fails and invokes {@link #setError()}. * * @since 1.6 */ protected void clearError() {
*** 428,443 **** * which also implement the write() methods of OutputStream */ /** * Writes the specified byte to this stream. If the byte is a newline and ! * automatic flushing is enabled then the <code>flush</code> method will be * invoked. * * <p> Note that the byte is written as given; to write a character that * will be translated according to the platform's default character ! * encoding, use the <code>print(char)</code> or <code>println(char)</code> * methods. * * @param b The byte to be written * @see #print(char) * @see #println(char) --- 428,443 ---- * which also implement the write() methods of OutputStream */ /** * Writes the specified byte to this stream. If the byte is a newline and ! * automatic flushing is enabled then the {@code flush} method will be * invoked. * * <p> Note that the byte is written as given; to write a character that * will be translated according to the platform's default character ! * encoding, use the {@code print(char)} or {@code println(char)} * methods. * * @param b The byte to be written * @see #print(char) * @see #println(char)
*** 458,474 **** trouble = true; } } /** ! * Writes <code>len</code> bytes from the specified byte array starting at ! * offset <code>off</code> to this stream. If automatic flushing is ! * enabled then the <code>flush</code> method will be invoked. * * <p> Note that the bytes will be written as given; to write characters * that will be translated according to the platform's default character ! * encoding, use the <code>print(char)</code> or <code>println(char)</code> * methods. * * @param buf A byte array * @param off Offset from which to start taking bytes * @param len Number of bytes to write --- 458,474 ---- trouble = true; } } /** ! * Writes {@code len} bytes from the specified byte array starting at ! * offset {@code off} to this stream. If automatic flushing is ! * enabled then the {@code flush} method will be invoked. * * <p> Note that the bytes will be written as given; to write characters * that will be translated according to the platform's default character ! * encoding, use the {@code print(char)} or {@code println(char)} * methods. * * @param buf A byte array * @param off Offset from which to start taking bytes * @param len Number of bytes to write
*** 563,573 **** * java.lang.String#valueOf(boolean)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param b The <code>boolean</code> to be printed */ public void print(boolean b) { write(b ? "true" : "false"); } --- 563,573 ---- * java.lang.String#valueOf(boolean)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param b The {@code boolean} to be printed */ public void print(boolean b) { write(b ? "true" : "false"); }
*** 575,585 **** * Prints a character. The character is translated into one or more bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param c The <code>char</code> to be printed */ public void print(char c) { write(String.valueOf(c)); } --- 575,585 ---- * Prints a character. The character is translated into one or more bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param c The {@code char} to be printed */ public void print(char c) { write(String.valueOf(c)); }
*** 588,598 **** * java.lang.String#valueOf(int)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param i The <code>int</code> to be printed * @see java.lang.Integer#toString(int) */ public void print(int i) { write(String.valueOf(i)); } --- 588,598 ---- * java.lang.String#valueOf(int)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param i The {@code int} to be printed * @see java.lang.Integer#toString(int) */ public void print(int i) { write(String.valueOf(i)); }
*** 602,612 **** * java.lang.String#valueOf(long)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param l The <code>long</code> to be printed * @see java.lang.Long#toString(long) */ public void print(long l) { write(String.valueOf(l)); } --- 602,612 ---- * java.lang.String#valueOf(long)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param l The {@code long} to be printed * @see java.lang.Long#toString(long) */ public void print(long l) { write(String.valueOf(l)); }
*** 616,626 **** * java.lang.String#valueOf(float)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param f The <code>float</code> to be printed * @see java.lang.Float#toString(float) */ public void print(float f) { write(String.valueOf(f)); } --- 616,626 ---- * java.lang.String#valueOf(float)}</code> is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param f The {@code float} to be printed * @see java.lang.Float#toString(float) */ public void print(float f) { write(String.valueOf(f)); }
*** 630,640 **** * <code>{@link java.lang.String#valueOf(double)}</code> is translated into * bytes according to the platform's default character encoding, and these * bytes are written in exactly the manner of the <code>{@link * #write(int)}</code> method. * ! * @param d The <code>double</code> to be printed * @see java.lang.Double#toString(double) */ public void print(double d) { write(String.valueOf(d)); } --- 630,640 ---- * <code>{@link java.lang.String#valueOf(double)}</code> is translated into * bytes according to the platform's default character encoding, and these * bytes are written in exactly the manner of the <code>{@link * #write(int)}</code> method. * ! * @param d The {@code double} to be printed * @see java.lang.Double#toString(double) */ public void print(double d) { write(String.valueOf(d)); }
*** 645,668 **** * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * * @param s The array of chars to be printed * ! * @throws NullPointerException If <code>s</code> is <code>null</code> */ public void print(char s[]) { write(s); } /** ! * Prints a string. If the argument is <code>null</code> then the string ! * <code>"null"</code> is printed. Otherwise, the string's characters are * converted into bytes according to the platform's default character * encoding, and these bytes are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param s The <code>String</code> to be printed */ public void print(String s) { if (s == null) { s = "null"; } --- 645,668 ---- * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * * @param s The array of chars to be printed * ! * @throws NullPointerException If {@code s} is {@code null} */ public void print(char s[]) { write(s); } /** ! * Prints a string. If the argument is {@code null} then the string ! * {@code "null"} is printed. Otherwise, the string's characters are * converted into bytes according to the platform's default character * encoding, and these bytes are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param s The {@code String} to be printed */ public void print(String s) { if (s == null) { s = "null"; }
*** 674,684 **** * java.lang.String#valueOf(Object)}</code> method is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param obj The <code>Object</code> to be printed * @see java.lang.Object#toString() */ public void print(Object obj) { write(String.valueOf(obj)); } --- 674,684 ---- * java.lang.String#valueOf(Object)}</code> method is translated into bytes * according to the platform's default character encoding, and these bytes * are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * ! * @param obj The {@code Object} to be printed * @see java.lang.Object#toString() */ public void print(Object obj) { write(String.valueOf(obj)); }
*** 687,709 **** /* Methods that do terminate lines */ /** * Terminates the current line by writing the line separator string. The * line separator string is defined by the system property ! * <code>line.separator</code>, and is not necessarily a single newline ! * character (<code>'\n'</code>). */ public void println() { newLine(); } /** * Prints a boolean and then terminate the line. This method behaves as * though it invokes <code>{@link #print(boolean)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>boolean</code> to be printed */ public void println(boolean x) { synchronized (this) { print(x); newLine(); --- 687,709 ---- /* Methods that do terminate lines */ /** * Terminates the current line by writing the line separator string. The * line separator string is defined by the system property ! * {@code line.separator}, and is not necessarily a single newline ! * character ({@code '\n'}). */ public void println() { newLine(); } /** * Prints a boolean and then terminate the line. This method behaves as * though it invokes <code>{@link #print(boolean)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code boolean} to be printed */ public void println(boolean x) { synchronized (this) { print(x); newLine();
*** 713,723 **** /** * Prints a character and then terminate the line. This method behaves as * though it invokes <code>{@link #print(char)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>char</code> to be printed. */ public void println(char x) { synchronized (this) { print(x); newLine(); --- 713,723 ---- /** * Prints a character and then terminate the line. This method behaves as * though it invokes <code>{@link #print(char)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code char} to be printed. */ public void println(char x) { synchronized (this) { print(x); newLine();
*** 727,737 **** /** * Prints an integer and then terminate the line. This method behaves as * though it invokes <code>{@link #print(int)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>int</code> to be printed. */ public void println(int x) { synchronized (this) { print(x); newLine(); --- 727,737 ---- /** * Prints an integer and then terminate the line. This method behaves as * though it invokes <code>{@link #print(int)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code int} to be printed. */ public void println(int x) { synchronized (this) { print(x); newLine();
*** 741,751 **** /** * Prints a long and then terminate the line. This method behaves as * though it invokes <code>{@link #print(long)}</code> and then * <code>{@link #println()}</code>. * ! * @param x a The <code>long</code> to be printed. */ public void println(long x) { synchronized (this) { print(x); newLine(); --- 741,751 ---- /** * Prints a long and then terminate the line. This method behaves as * though it invokes <code>{@link #print(long)}</code> and then * <code>{@link #println()}</code>. * ! * @param x a The {@code long} to be printed. */ public void println(long x) { synchronized (this) { print(x); newLine();
*** 755,765 **** /** * Prints a float and then terminate the line. This method behaves as * though it invokes <code>{@link #print(float)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>float</code> to be printed. */ public void println(float x) { synchronized (this) { print(x); newLine(); --- 755,765 ---- /** * Prints a float and then terminate the line. This method behaves as * though it invokes <code>{@link #print(float)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code float} to be printed. */ public void println(float x) { synchronized (this) { print(x); newLine();
*** 769,779 **** /** * Prints a double and then terminate the line. This method behaves as * though it invokes <code>{@link #print(double)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>double</code> to be printed. */ public void println(double x) { synchronized (this) { print(x); newLine(); --- 769,779 ---- /** * Prints a double and then terminate the line. This method behaves as * though it invokes <code>{@link #print(double)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code double} to be printed. */ public void println(double x) { synchronized (this) { print(x); newLine();
*** 797,807 **** /** * Prints a String and then terminate the line. This method behaves as * though it invokes <code>{@link #print(String)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>String</code> to be printed. */ public void println(String x) { synchronized (this) { print(x); newLine(); --- 797,807 ---- /** * Prints a String and then terminate the line. This method behaves as * though it invokes <code>{@link #print(String)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code String} to be printed. */ public void println(String x) { synchronized (this) { print(x); newLine();
*** 813,823 **** * at first String.valueOf(x) to get the printed object's string value, * then behaves as * though it invokes <code>{@link #print(String)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The <code>Object</code> to be printed. */ public void println(Object x) { String s = String.valueOf(x); synchronized (this) { print(s); --- 813,823 ---- * at first String.valueOf(x) to get the printed object's string value, * then behaves as * though it invokes <code>{@link #print(String)}</code> and then * <code>{@link #println()}</code>. * ! * @param x The {@code Object} to be printed. */ public void println(Object x) { String s = String.valueOf(x); synchronized (this) { print(s);
*** 828,842 **** /** * A convenience method to write a formatted string to this output stream * using the specified format string and arguments. * ! * <p> An invocation of this method of the form <tt>out.printf(format, ! * args)</tt> behaves in exactly the same way as the invocation ! * ! * <pre> ! * out.format(format, args) </pre> * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a> * --- 828,844 ---- /** * A convenience method to write a formatted string to this output stream * using the specified format string and arguments. * ! * <p> An invocation of this method of the form ! * {@code out.printf(format, args)} behaves ! * in exactly the same way as the invocation ! * ! * <pre>{@code ! * out.format(format, args) ! * }</pre> * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a> *
*** 846,856 **** * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * <tt>null</tt> argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments, --- 848,858 ---- * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * {@code null} argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments,
*** 859,869 **** * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the <tt>format</tt> is <tt>null</tt> * * @return This output stream * * @since 1.5 */ --- 861,871 ---- * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the {@code format} is {@code null} * * @return This output stream * * @since 1.5 */
*** 873,891 **** /** * A convenience method to write a formatted string to this output stream * using the specified format string and arguments. * ! * <p> An invocation of this method of the form <tt>out.printf(l, format, ! * args)</tt> behaves in exactly the same way as the invocation ! * ! * <pre> ! * out.format(l, format, args) </pre> * * @param l * The {@linkplain java.util.Locale locale} to apply during ! * formatting. If <tt>l</tt> is <tt>null</tt> then no localization * is applied. * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a> --- 875,895 ---- /** * A convenience method to write a formatted string to this output stream * using the specified format string and arguments. * ! * <p> An invocation of this method of the form ! * {@code out.printf(l, format, args)} behaves ! * in exactly the same way as the invocation ! * ! * <pre>{@code ! * out.format(l, format, args) ! * }</pre> * * @param l * The {@linkplain java.util.Locale locale} to apply during ! * formatting. If {@code l} is {@code null} then no localization * is applied. * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a>
*** 896,906 **** * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * <tt>null</tt> argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments, --- 900,910 ---- * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * {@code null} argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments,
*** 909,919 **** * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the <tt>format</tt> is <tt>null</tt> * * @return This output stream * * @since 1.5 */ --- 913,923 ---- * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the {@code format} is {@code null} * * @return This output stream * * @since 1.5 */
*** 939,949 **** * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * <tt>null</tt> argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments, --- 943,953 ---- * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * {@code null} argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments,
*** 952,962 **** * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the <tt>format</tt> is <tt>null</tt> * * @return This output stream * * @since 1.5 */ --- 956,966 ---- * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the {@code format} is {@code null} * * @return This output stream * * @since 1.5 */
*** 981,991 **** * Writes a formatted string to this output stream using the specified * format string and arguments. * * @param l * The {@linkplain java.util.Locale locale} to apply during ! * formatting. If <tt>l</tt> is <tt>null</tt> then no localization * is applied. * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a> --- 985,995 ---- * Writes a formatted string to this output stream using the specified * format string and arguments. * * @param l * The {@linkplain java.util.Locale locale} to apply during ! * formatting. If {@code l} is {@code null} then no localization * is applied. * * @param format * A format string as described in <a * href="../util/Formatter.html#syntax">Format string syntax</a>
*** 996,1006 **** * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * <tt>null</tt> argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments, --- 1000,1010 ---- * extra arguments are ignored. The number of arguments is * variable and may be zero. The maximum number of arguments is * limited by the maximum dimension of a Java array as defined by * <cite>The Java&trade; Virtual Machine Specification</cite>. * The behaviour on a ! * {@code null} argument depends on the <a * href="../util/Formatter.html#syntax">conversion</a>. * * @throws java.util.IllegalFormatException * If a format string contains an illegal syntax, a format * specifier that is incompatible with the given arguments,
*** 1009,1019 **** * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the <tt>format</tt> is <tt>null</tt> * * @return This output stream * * @since 1.5 */ --- 1013,1023 ---- * formatting errors, see the <a * href="../util/Formatter.html#detail">Details</a> section of the * formatter class specification. * * @throws NullPointerException ! * If the {@code format} is {@code null} * * @return This output stream * * @since 1.5 */
*** 1035,1059 **** } /** * Appends the specified character sequence to this output stream. * ! * <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.print(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 then <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 output stream. * * @return This output stream * * @since 1.5 --- 1039,1064 ---- } /** * Appends the specified character sequence to this output stream. * ! * <p> An invocation of this method of the form {@code out.append(csq)} * behaves in exactly the same way as the invocation * ! * <pre>{@code ! * out.print(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 then {@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 output stream. * * @return This output stream * * @since 1.5
*** 1068,1089 **** /** * Appends a subsequence of the specified character sequence to this output * stream. * ! * <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.print(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 --- 1073,1096 ---- /** * Appends a subsequence of the specified character sequence to this output * stream. * ! * <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.print(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
*** 1091,1103 **** * subsequence * * @return This output stream * * @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 PrintStream append(CharSequence csq, int start, int end) { CharSequence cs = (csq == null ? "null" : csq); --- 1098,1110 ---- * subsequence * * @return This output stream * * @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 PrintStream append(CharSequence csq, int start, int end) { CharSequence cs = (csq == null ? "null" : csq);
*** 1106,1120 **** } /** * Appends the specified character to this output stream. * ! * <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.print(c) </pre> * * @param c * The 16-bit character to append * * @return This output stream --- 1113,1128 ---- } /** * Appends the specified character to this output stream. * ! * <p> An invocation of this method of the form {@code out.append(c)} * behaves in exactly the same way as the invocation * ! * <pre>{@code ! * out.print(c) ! * }</pre> * * @param c * The 16-bit character to append * * @return This output stream
< prev index next >