|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ix.util.Util
Class for useful static methods.
Inner Class Summary | |
static class |
Util.NameGenerator
Name generator a la gensym. |
Constructor Summary | |
Util()
|
Method Summary | |
static java.lang.String |
askLine(java.lang.String prompt)
Simple, text-based user interaction. |
static java.util.List |
breakIntoLines(java.lang.String text)
Returns a List of the lines in a string. |
static java.lang.String[] |
breakStringAtFirst(java.lang.String s,
java.lang.String separator)
breakStringAtFirst takes a string containing fields separated by a (string) delimiter and returns a two-element string array containing the substring before the first occurrence of the char, and the substring after. |
static java.lang.String |
capitalizeString(java.lang.String s)
Returns a copy of the string in which the first character is in upper case and the rest of the string is left as it was. |
static void |
displayMessage(java.awt.Component parentComponent,
java.lang.String text)
Displays a text message in a dialogue box. |
static java.lang.String |
firstLine(java.lang.String s)
Returns the first line of a string. |
static java.lang.String |
generateName(java.lang.String base)
Generates a name unique within this VM that begins with the specified base string. |
static void |
printGreeting(java.lang.String name)
A method to print the name of the system, the release version, and the release date. |
static void |
printLines(java.lang.String[] lines)
Print the elements of a String[] array to System.out as lines. |
static java.lang.String |
quote(java.lang.String text)
Puts double quotes around a string. |
static java.lang.String |
readLine(java.io.InputStream is)
Reads a line from an InputStream and returns it as a String. |
static java.lang.String |
repeatString(java.lang.String s,
int count)
Returns a String made by appending a specified string count times. |
static java.lang.String |
restLines(java.lang.String s)
Returns the rest of a string after the first line has been removed. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Util()
Method Detail |
public static void printGreeting(java.lang.String name)
public static void displayMessage(java.awt.Component parentComponent, java.lang.String text)
parentComponent
- determines the Frame in which dialogs
are displayed.text
- the contents of the message.public static java.lang.String[] breakStringAtFirst(java.lang.String s, java.lang.String separator)
public static java.lang.String firstLine(java.lang.String s)
public static java.lang.String restLines(java.lang.String s)
public static java.util.List breakIntoLines(java.lang.String text)
public static java.lang.String quote(java.lang.String text)
public static java.lang.String capitalizeString(java.lang.String s)
public static java.lang.String repeatString(java.lang.String s, int count)
public static java.lang.String generateName(java.lang.String base)
public static void printLines(java.lang.String[] lines)
public static java.lang.String askLine(java.lang.String prompt)
If askLine blocks when reading, we'd like other threads to be able to run; but that doesn't seem to happen reliably. Presumably, this is a bug. In any case, askLine works around the problem by having a loop that checks whether input is available and sleeps for a second if it isn't.
public static java.lang.String readLine(java.io.InputStream is)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |