|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.myjavatools.lib.Objects
com.myjavatools.lib.Strings
com.myjavatools.lib.Files
com.myjavatools.lib.Web
com.myjavatools.lib.Tools
| Nested Class Summary |
| Nested classes inherited from class com.myjavatools.lib.Files |
Files.BufferingFilter, Files.ByteFilter |
| Field Summary |
| Fields inherited from class com.myjavatools.lib.Files |
directoryFilter, FIND_ALL, FIND_DIRECTORY, FIND_FILE |
| Fields inherited from class com.myjavatools.lib.Strings |
_FALSE_, _TRUE_, _UNDEF_, ESCAPED, ESCAPEE |
| Method Summary | |
static boolean |
bark(java.lang.String msg)
Displays an error message |
static java.lang.String |
commandLineArg(java.lang.String arg)
Wraps command line argument into quotes if it contains spaces |
static void |
fatalError(boolean condition,
java.lang.String message)
Reports a fatal error to sderr and exits, upon a condition |
static void |
fatalError(java.lang.Exception exception)
Reports a fatal exception to sderr and exits |
static void |
fatalError(java.lang.String message)
Reports a fatal error to sderr and exits |
static void |
fatalError(java.lang.String message,
java.lang.Exception exception)
Reports an error message and an exception to sderr and exits |
static java.lang.String |
freeMemory()
Collects garbage, reports back |
static java.lang.Long[] |
gc()
Collects garbage, reports back |
static java.lang.String |
getCommandOutput(java.lang.String command)
returns as string the output of a command |
static boolean |
inform(java.lang.String msg)
Displays an informative message |
static boolean |
runCommand(java.lang.String cmd)
Runs a command in current directory |
static boolean |
runCommand(java.lang.String cmd,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
Runs a command in current directory |
static boolean |
runCommand(java.lang.String cmd,
java.io.PrintStream out,
java.io.PrintStream err)
Runs a command in current directory |
static boolean |
runCommand(java.lang.String cmd,
java.lang.String dir)
Runs a command in specified directory |
static boolean |
runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
Runs a command in specified directory |
static boolean |
runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.PrintStream out,
java.io.PrintStream err)
Runs a command in specified directory |
static boolean |
runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.Reader in,
java.io.PrintWriter out,
java.io.PrintWriter err)
Runs a command in specified directory |
static boolean |
whether(java.lang.String msg)
Displays a message and receives user's choice (yes/no) |
| Methods inherited from class com.myjavatools.lib.Web |
downloadFile, downloadFile, getCharsetByEncoding, getEncodingByCharset, getHtmlCharset, getHtmlEncoding, getUrlInputStream, getXmlCharset, getXmlEncoding, quote, sendMail, toWebReadable, url, url, url, url, url, url, url, urlEncode |
| Methods inherited from class com.myjavatools.lib.Files |
adjustSizeByMooreLaw, appendBytesToFile, appendBytesToFile, appendToFile, appendToFile, appendToFile, chdir, compare, copy, copy, copy, copy, deleteFile, deleteFile, dirname, dirname, filename, find, find, find, findLatest, findLatest, findLatestDirectory, findLatestFile, getcwd, getFullPath, getFullPath, getPackageName, install, install, lastModified, listSubdirectories, makeFile, makeFile, makeFile, makeFile, makeFile, makeFile, makeFile, makeFile, makeFileWriter, path, pipe, pipe, pipe, readBytesFromFile, readBytesFromStream, readBytesFromStream, readString, readStringFromFile, readStringFromFile, readStringFromFile, relPath, splitPath, synchronize, synchronize, unzip, writeBytesToFile, writeToFile, writeToFile, writeToFile, writeToFile |
| Methods inherited from class com.myjavatools.lib.Objects |
asMap, cat, compose, crc32, crc32, getList, getMap, getMap, getSet, indexOf, indexOf, indexOf, indexOf, inverse, isEmpty, map, map, map, map, map, reallocate, toBytes, toBytes, toChars, toMap, toMap, toMap, toMap, toSet, union |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final void fatalError(boolean condition,
java.lang.String message)
condition - it is fatal error when condition is truemessage - the error message
fatalError(!file.exists(), "File " + file + " does not exist!")
public static final void fatalError(java.lang.String message)
message - the error message
fatalError("Your System is Windows!")
public static final void fatalError(java.lang.Exception exception)
exception - the fatal exception
try { prints
String s = null;
s.toString();
} catch (Exception e) {
fatalError(e);
}
java.lang.NullPointerException
at com.myjavatools.util.Tools.main
public static final void fatalError(java.lang.String message,
java.lang.Exception exception)
message - the error messageexception - the fatal exception
try { prints
String s = null;
s.toString();
} catch (Exception e) {
fatalError("Null pointers are bad!", e);
}
Null pointers are bad!
java.lang.NullPointerException
at com.myjavatools.util.Tools.main
public static boolean bark(java.lang.String msg)
msg - the message to display
bark("Code Red Alert!").public static boolean inform(java.lang.String msg)
msg - the message to display
inform("To beguile the time, be like the time.").public static boolean whether(java.lang.String msg)
msg - the messge to display
if (!whether("Want this program to proceed?")) System.exit(1);public static java.lang.Long[] gc()
public static java.lang.String freeMemory()
public static boolean runCommand(java.lang.String cmd)
cmd - the command to run; append '&' if no need to wait
runCommand("notepad&")> launches NotepadrunCommand("rmdir xxx")> returns false
(unless you had a directory 'xxx' and it was just removed).
public static boolean runCommand(java.lang.String cmd,
java.lang.String dir)
cmd - the command to run; append '&' if no need to waitdir - starting directory name
runCommand("cmd /c dir .", "C:\\Program Files")>.
public static boolean runCommand(java.lang.String cmd,
java.io.PrintStream out,
java.io.PrintStream err)
cmd - the command to run; append '&' if no need to waitout - command output streamerr - command error stream
runCommand("cmd /c dir .", "C:\\Program Files", System.out, System.err)>.
public static boolean runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.PrintStream out,
java.io.PrintStream err)
cmd - the command to run; append '&' if no need to waitdir - starting directory nameout - command output streamerr - command error stream
runCommand("cmd /c dir .", "C:\\Program Files", System.out, System.err)>.
public static boolean runCommand(java.lang.String cmd,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
cmd - the command to run; append '&' if no need to waitin - command input streamout - command output streamerr - command error stream
runCommand("cmd /c dir .", "C:\\Program Files", System.in, System.out, System.err)>.
public static boolean runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.InputStream in,
java.io.PrintStream out,
java.io.PrintStream err)
cmd - the command to run; append '&' if no need to waitdir - starting directory namein - command input streamout - command output streamerr - command error stream
runCommand("cmd /c dir .", "C:\\Program Files", System.in, System.out, System.err)>.
public static boolean runCommand(java.lang.String cmd,
java.lang.String dir,
java.io.Reader in,
java.io.PrintWriter out,
java.io.PrintWriter err)
cmd - the command to run; append '&' if no need to waitdir - starting directory namein - command input readerout - command output writererr - command error writer
runCommand("cmd /c dir .", "C:\\Program Files", System.in, System.out, System.err)>.public static java.lang.String getCommandOutput(java.lang.String command)
command - String the command to run
public static java.lang.String commandLineArg(java.lang.String arg)
arg -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||