|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.nist.nlpir.irf.util.Support
Provides miscellaneous methods to support some logging, access to system and runtime values, basic test mode functions, input methods, etc.
InfoObj
Field Summary | |
static int |
COARSE_TRACE
Trace level constant |
static char |
COMMENT_CHAR
Everything beyond this sign is a comment that readLine()
won't return. |
static int |
DETAIL_TRACE
Trace level constant |
private static java.io.PrintWriter |
errorWriter
Working PrintWriter for error message output |
static java.lang.String |
fileSeparator
Working local copy of file separator character |
static int |
MEDIUM_TRACE
Trace level constant |
private static boolean |
outputState
Flag indicating if debugging output is to be produced or not |
private static java.io.PrintWriter |
outputWriter
Working PrintWriter for use by the local methods print and println |
private static boolean |
promptUser
Flag indicating if the user is to be prompted for input |
private static java.io.PrintWriter |
promptWriter
Working PrintWriter for input prompt message output |
private static java.lang.Runtime |
runtime
Working instance of a Runtime object |
private static java.io.BufferedReader |
sysRdr
This reader should be the only one in the whole application listening to STDIN. |
private static boolean |
testMode
Flag indicating weather the application is in test mode |
static int |
traceLevel
Current trace level |
private static java.io.PrintWriter |
traceWriter
Working PrintWriter for trace message output |
private static java.io.PrintWriter |
warningWriter
Working PrintWriter for warning message output |
Constructor Summary | |
Support()
|
Method Summary | |
static void |
debugOutputOn(boolean state)
Sets state of debuging output. |
static void |
errorMessage(java.lang.String message)
Writes message to the error writer. |
static boolean |
executeTrace(int level)
Returns true if the supplied level would result in a trace message being generated. |
static java.io.PrintWriter |
getErrorWriter()
Gets the writer to which error messages are being directed. |
static boolean |
getPromptUser()
Gets value of promptUser. |
static java.io.PrintWriter |
getPromptWriter()
Gets the writer to which user prompts are being directed. |
static boolean |
getTestMode()
Gets the test mode. |
static long |
getTimeInMillis()
Gets time in milliseconds since midnight Jan 1st 1970. |
static int |
getTraceLevel()
Gets the maximum level of trace messages to be generated. |
static java.io.PrintWriter |
getTraceWriter()
Gets the writer to which trace messages are being directed. |
static java.io.PrintWriter |
getWarningWriter()
Gets the writer to which warning messages are being directed. |
static void |
printTimestamp()
Writes a timestamp to standard out. |
static void |
printVM_MemoryStats()
If printing debugging output, writes stats on memory usage by the Java virtual machine to standard out. |
static void |
printVM_MemoryStatsWithGC()
If printing debugging output, writes stats on memory usage by the Java virtual machine to standard out after calling gabage collection. |
static boolean |
queryDebugOutput()
Gets state of debugging output. |
static java.lang.String |
readLine()
This method mainly embeds BufferedReader.readLine() so that it doesn't raise any exception and, moreover, the entire application can share a unique reader based on the standard output, thus allowing to have, for example, command files. NOTE ON COMMENTS: In order for those command files to be usable, a comment mechanism appeared. |
static void |
requestGarbageCollection()
Requests the garbage collector be run. |
static void |
setErrorWriter(java.io.PrintStream stream)
Sets the writer to a writer for the stream to which errors messages will be directed. |
static void |
setErrorWriter(java.io.PrintWriter writer)
Sets the writer to which errors messages will be directed. |
static void |
setPrintWriter(java.io.PrintStream pStream)
Sets output writer to a writer for the stream for debugging output. |
static void |
setPrintWriter(java.io.PrintWriter writer)
Sets output print writer for debugging output. |
static void |
setPromptUser(boolean mode)
Sets the promptUser. |
static void |
setPromptWriter(java.io.PrintStream stream)
Sets the writer to a writer for the stream to which user prompts will be directed. |
static void |
setPromptWriter(java.io.PrintWriter writer)
Sets the writer to which user prompts will be directed. |
static void |
setTestMode(boolean mode)
Sets the test mode. |
static void |
setTraceLevel(int level)
Sets the maximum level of trace messages to be generated. |
static void |
setTraceWriter(java.io.PrintStream stream)
Sets the writer to a writer for the stream to which trace messages will be directed. |
static void |
setTraceWriter(java.io.PrintWriter writer)
Sets the writer to which trace messages will be directed. |
static void |
setWarningWriter(java.io.PrintStream stream)
Sets the writer to a writer for the stream to which warning messages will be directed. |
static void |
setWarningWriter(java.io.PrintWriter writer)
Sets the writer to which warning messages will be directed. |
static void |
traceMessage(int level,
java.lang.String message)
Writes message to the trace writer. |
static void |
traceMessage(int level,
java.lang.String s1,
int v1,
java.lang.String s2,
int v2,
java.lang.String s3,
int v3)
Writes message to the trace writer. |
static void |
traceMessage(java.lang.String message)
Writes message to the trace writer. |
static void |
userPrompt(java.lang.String prompt)
Writes the user prompt to the prompt writer. |
static void |
userPromptLn(java.lang.String prompt)
Writes the user prompt to the prompt writer. |
static void |
warningMessage(java.lang.String message)
Writes message to the warning stream. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int COARSE_TRACE
public static final int MEDIUM_TRACE
public static final int DETAIL_TRACE
public static final java.lang.String fileSeparator
private static boolean outputState
private static boolean promptUser
private static boolean testMode
public static int traceLevel
private static java.io.PrintWriter errorWriter
private static java.io.PrintWriter outputWriter
private static java.io.PrintWriter promptWriter
private static java.io.PrintWriter traceWriter
private static java.io.PrintWriter warningWriter
private static java.lang.Runtime runtime
private static java.io.BufferedReader sysRdr
public static final char COMMENT_CHAR
readLine()
won't return.Constructor Detail |
public Support()
Method Detail |
public static final void setErrorWriter(java.io.PrintWriter writer)
writer
- where error messages are to be sent.public static final void setErrorWriter(java.io.PrintStream stream)
stream
- where error messages are to be sent.public static final java.io.PrintWriter getErrorWriter()
public static final void errorMessage(java.lang.String message)
message
- text to be printed on error writer.public static final void setTraceLevel(int level)
level
- new maximum level of trace messages to be generated.public static final int getTraceLevel()
public static final boolean executeTrace(int level)
level
- to be checked against current trace level.public static void setTraceWriter(java.io.PrintWriter writer)
writer
- where trace messages are to be sent.public static final void setTraceWriter(java.io.PrintStream stream)
stream
- where trace messages are to be sent.public static final java.io.PrintWriter getTraceWriter()
public static final void traceMessage(int level, java.lang.String s1, int v1, java.lang.String s2, int v2, java.lang.String s3, int v3)
level
- at which this trace messages is to be sent.message
- text to be printed on trace writer.public static final void traceMessage(int level, java.lang.String message)
level
- at which this trace messages is to be sent.message
- text to be printed on trace writer.public static void traceMessage(java.lang.String message)
message
- text to be printed on trace writer.public static final void setWarningWriter(java.io.PrintWriter writer)
writer
- where warning messages are to be sent.public static final void setWarningWriter(java.io.PrintStream stream)
stream
- where warning messages are to be sent.public static final java.io.PrintWriter getWarningWriter()
public static final void warningMessage(java.lang.String message)
level
- at which this warning messages is to be sent.message
- text to be printed on warning stream.public static final void setTestMode(boolean mode)
mode
- test mode on/off.public static final boolean getTestMode()
public static final void setPromptUser(boolean mode)
promptUser
- on/off.public static final boolean getPromptUser()
public static final void setPromptWriter(java.io.PrintWriter writer)
writer
- where user prompt are to be sent.public static final void setPromptWriter(java.io.PrintStream stream)
stream
- where user prompts are to be sent.public static final java.io.PrintWriter getPromptWriter()
public static final void userPrompt(java.lang.String prompt)
message
- text to be printed on prompt writer.public static final void userPromptLn(java.lang.String prompt)
message
- text to be printed on prompt writer.public static final void debugOutputOn(boolean state)
state
- new state of debugging output, set to true to
turn on debugging output, false to turn off.public static final boolean queryDebugOutput()
public static final void setPrintWriter(java.io.PrintWriter writer)
writer
- print writer for debugging outputpublic static final void setPrintWriter(java.io.PrintStream pStream)
pStream
- print stream for debugging outputpublic static final void printTimestamp()
public static final long getTimeInMillis()
public static final void requestGarbageCollection()
public static final void printVM_MemoryStats()
public static final void printVM_MemoryStatsWithGC()
public static final java.lang.String readLine()
COMMENT_CHAR
:COMMENT_CHAR
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |