Fixed method signatures on format() methods to return PrintStream as in OpenJDK

This commit is contained in:
BCG 2015-07-28 22:28:37 -04:00
parent e7dbe89c74
commit b766193966

View File

@ -78,23 +78,25 @@ public class PrintStream extends OutputStream {
print(String.valueOf(s)); print(String.valueOf(s));
} }
public synchronized void printf(java.util.Locale locale, String format, Object... args) { public synchronized PrintStream printf(java.util.Locale locale, String format, Object... args) {
// should this be cached in an instance variable?? // should this be cached in an instance variable??
final java.util.Formatter formatter = new java.util.Formatter(this); final java.util.Formatter formatter = new java.util.Formatter(this);
formatter.format(locale, format, args); formatter.format(locale, format, args);
return this;
} }
public synchronized void printf(String format, Object... args) { public synchronized PrintStream printf(String format, Object... args) {
final java.util.Formatter formatter = new java.util.Formatter(this); final java.util.Formatter formatter = new java.util.Formatter(this);
formatter.format(format, args); formatter.format(format, args);
return this;
} }
public void format(String format, Object... args) { public PrintStream format(String format, Object... args) {
printf(format, args); return printf(format, args);
} }
public void format(java.util.Locale locale, String format, Object... args) { public PrintStream format(java.util.Locale locale, String format, Object... args) {
printf(locale, format, args); return printf(locale, format, args);
} }
public synchronized void println(String s) { public synchronized void println(String s) {