Skip to content

Instantly share code, notes, and snippets.

@upsilon
Created September 29, 2010 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save upsilon/603006 to your computer and use it in GitHub Desktop.
Save upsilon/603006 to your computer and use it in GitHub Desktop.
import java.io.*;
public class PrintTool {
public static final PrintTool out = new PrintTool();
private PrintStream stream;
public PrintTool() {
this(System.out);
}
public PrintTool(PrintStream stream) {
this.stream = stream;
}
public PrintTool p(Object obj) {
return print(obj);
}
public PrintTool p(Object... obj) {
return print(obj);
}
public PrintTool print(Object obj) {
stream.print(obj);
return this;
}
public PrintTool print(Object... obj) {
for (Object o : obj) {
print(o);
}
return this;
}
public PrintTool pl() {
return println();
}
public PrintTool pl(Object obj) {
return println(obj);
}
public PrintTool pl(Object... obj) {
return println(obj);
}
public PrintTool println() {
stream.println();
return this;
}
public PrintTool println(Object obj) {
stream.println(obj);
return this;
}
public PrintTool println(Object... obj) {
for (Object o : obj) {
print(o);
}
return println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment