< prev index next >
src/java.base/share/classes/java/io/PrintStream.java
Print this page
rev 15365 : imported patch 8163517-Various-cleanup-in-java-io-code
*** 566,576 ****
* {@link #write(int)} method.
*
* @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
! write(b ? "true" : "false");
}
/**
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
--- 566,576 ----
* {@link #write(int)} method.
*
* @param b The {@code boolean} to be printed
*/
public void print(boolean b) {
! write(String.valueOf(b));
}
/**
* Prints a character. The character is translated into one or more bytes
* according to the platform's default character encoding, and these bytes
*** 661,674 ****
* {@link #write(int)} method.
*
* @param s The {@code String} to be printed
*/
public void print(String s) {
! if (s == null) {
! s = "null";
! }
! write(s);
}
/**
* Prints an object. The string produced by the {@link
* java.lang.String#valueOf(Object)} method is translated into bytes
--- 661,671 ----
* {@link #write(int)} method.
*
* @param s The {@code String} to be printed
*/
public void print(String s) {
! write(String.valueOf(s));
}
/**
* Prints an object. The string produced by the {@link
* java.lang.String#valueOf(Object)} method is translated into bytes
*** 1066,1079 ****
* @return This output stream
*
* @since 1.5
*/
public PrintStream append(CharSequence csq) {
! if (csq == null)
! print("null");
! else
! print(csq.toString());
return this;
}
/**
* Appends a subsequence of the specified character sequence to this output
--- 1063,1073 ----
* @return This output stream
*
* @since 1.5
*/
public PrintStream append(CharSequence csq) {
! print(String.valueOf(csq));
return this;
}
/**
* Appends a subsequence of the specified character sequence to this output
*** 1109,1121 ****
* {@code csq.length()}
*
* @since 1.5
*/
public PrintStream append(CharSequence csq, int start, int end) {
! CharSequence cs = (csq == null ? "null" : csq);
! write(cs.subSequence(start, end).toString());
! return this;
}
/**
* Appends the specified character to this output stream.
*
--- 1103,1114 ----
* {@code csq.length()}
*
* @since 1.5
*/
public PrintStream append(CharSequence csq, int start, int end) {
! if (csq == null) csq = "null";
! return append(csq.subSequence(start, end));
}
/**
* Appends the specified character to this output stream.
*
< prev index next >