Created
September 29, 2010 15:56
-
-
Save upsilon/603006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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