|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpoker.util.Reporter
public class Reporter
Handles reporting messages to stdout or stderr, and logging messages to files. Defaults to printing output to stderr.
Field Summary | |
---|---|
int |
level
Non-negative value indicating priority threshold for reporting messages. |
Constructor Summary | |
---|---|
Reporter()
|
|
Reporter(java.lang.String logfile)
|
Method Summary | |
---|---|
void |
addReportListener(ReportListener rl)
|
void |
appendLog(java.lang.String s)
Logs a message to a file. |
static java.lang.String |
center(java.lang.String s,
int size)
Pads s with space on both sides so as to center it, returning a string of length size. |
void |
consoleOff()
disable the output to console |
void |
consoleOn()
Set the output to console |
void |
debug(java.lang.String s)
|
void |
debugb(java.lang.String s)
|
static boolean |
fileExists(java.lang.String s)
|
void |
finalize()
|
java.lang.String |
format(java.lang.String s)
|
static Reporter |
getReporter()
|
static java.lang.String |
loadExec(java.lang.String cmnd)
Attempts to execute the command. |
static java.lang.String |
loadFile(java.lang.String fname)
Load the contents of a text file into a String |
static void |
log(java.lang.String s,
java.lang.String file)
Logs a message to a file. |
static java.lang.String |
pad(java.lang.String s,
int size)
|
static java.lang.String |
padLeft(java.lang.String s,
int size)
|
static void |
pause()
wait for the user to type enter. |
void |
print(java.lang.String s)
Print a message to the current output stream. |
void |
println(java.lang.String s)
Print a message to the current output stream. |
java.lang.String |
prompt(java.lang.String s)
Prompt the user for a string. |
static java.lang.String |
readLine()
Read a line of text from stdin. |
static java.lang.String |
readString()
Return the next line typed by the user. |
void |
removeReportListener(ReportListener rl)
|
void |
report(java.lang.String s)
Print a message to the current output stream. |
void |
report(java.lang.String s,
int priority)
Print a message to the current output stream if the priority is high enough. |
void |
reportb(java.lang.String s)
Print a message to the current output stream. |
static double |
round(double f,
int precision)
|
void |
setActive(boolean t)
|
void |
setDebug(boolean on)
|
void |
setLogFile(java.lang.String logfile)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int level
Constructor Detail |
---|
public Reporter()
public Reporter(java.lang.String logfile)
Method Detail |
---|
public static Reporter getReporter()
public void setLogFile(java.lang.String logfile)
public void setDebug(boolean on)
public void setActive(boolean t)
public void debug(java.lang.String s)
public void debugb(java.lang.String s)
public void addReportListener(ReportListener rl)
public void removeReportListener(ReportListener rl)
public void consoleOff()
public void consoleOn()
public void println(java.lang.String s)
s
- the string to print.public void print(java.lang.String s)
s
- the string to print.public void report(java.lang.String s)
s
- the string to print.public void reportb(java.lang.String s)
s
- the string to print.public void report(java.lang.String s, int priority)
s
- the string to print.priority
- the priority of this messagepublic static void log(java.lang.String s, java.lang.String file)
s
- the message to log.file
- the name of the file to log to.public void appendLog(java.lang.String s)
s
- the message to log.public static java.lang.String readLine()
public static double round(double f, int precision)
public static java.lang.String pad(java.lang.String s, int size)
public static java.lang.String padLeft(java.lang.String s, int size)
public static java.lang.String center(java.lang.String s, int size)
public void finalize()
finalize
in class java.lang.Object
public static java.lang.String loadFile(java.lang.String fname)
fname
- the file name
public static java.lang.String loadExec(java.lang.String cmnd)
cmnd
- the command to execute
public java.lang.String prompt(java.lang.String s)
s
- the text prompt
public static java.lang.String readString()
public static void pause()
public java.lang.String format(java.lang.String s)
public static boolean fileExists(java.lang.String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |