< prev index next >
src/java.base/share/classes/java/io/PrintWriter.java
Print this page
rev 15357 : imported patch 8163517-Various-cleanup-in-java-io-code
*** 502,512 ****
* #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
--- 502,512 ----
* #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
*** 597,610 ****
* {@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
--- 597,607 ----
* {@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
*** 1003,1016 ****
* @return This writer
*
* @since 1.5
*/
public PrintWriter append(CharSequence csq) {
! if (csq == null)
! write("null");
! else
! write(csq.toString());
return this;
}
/**
* Appends a subsequence of the specified character sequence to this writer.
--- 1000,1010 ----
* @return This writer
*
* @since 1.5
*/
public PrintWriter append(CharSequence csq) {
! write(String.valueOf(csq));
return this;
}
/**
* Appends a subsequence of the specified character sequence to this writer.
*** 1045,1056 ****
* {@code csq.length()}
*
* @since 1.5
*/
public PrintWriter 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 writer.
--- 1039,1050 ----
* {@code csq.length()}
*
* @since 1.5
*/
public PrintWriter append(CharSequence csq, int start, int end) {
! if (csq == null) csq = "null";
! write(csq.subSequence(start, end).toString());
return this;
}
/**
* Appends the specified character to this writer.
< prev index next >