|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gridsystems.config.tools.console.ConsoleTools
public final class ConsoleTools
Helper functions for console interaction.
| Method Summary | |
|---|---|
static java.lang.String |
center(java.lang.String s,
int width)
Centers s in a line of "width" characters by adding spaces to its left. |
static void |
clear()
Clears the screen. |
static void |
fill(java.lang.StringBuffer sb,
char c,
int count)
Adds count characters "c" to the end of sb. |
static void |
paintBox(java.lang.String title,
java.lang.Object[] contents,
int width)
Displays a bordered box in the console, with the specified title, contents and width. |
static java.lang.String |
readLine(java.lang.String prompt)
Reads a line of text from the console. |
static java.lang.String |
readPassword(java.lang.String prompt,
char replaceChar)
Reads a line, masking the typed characters so they are not visible for casual observers. |
static void |
setup(boolean ansi,
boolean acs)
Sets the console configuration regarding to ANSI compliance and Alternate Character Set support. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void setup(boolean ansi,
boolean acs)
ansi - true if the console supports ANSI escape sequencesacs - true if the console supports ACS for line-drawingpublic static void clear()
public static java.lang.String readLine(java.lang.String prompt)
throws java.io.IOException
prompt - The user prompt
java.io.IOException - In case of I/O error
public static java.lang.String readPassword(java.lang.String prompt,
char replaceChar)
throws java.io.IOException
prompt - The prompt for the userreplaceChar - The character to show instead of the typed ones
java.io.IOException - In case of I/O error
public static void fill(java.lang.StringBuffer sb,
char c,
int count)
sb - The buffer to fillc - The character to addcount - The number of characters to add
public static java.lang.String center(java.lang.String s,
int width)
s - The string to centerwidth - The width of the line in characters
public static void paintBox(java.lang.String title,
java.lang.Object[] contents,
int width)
title - The box titlecontents - The box contentswidth - The box width in characters
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||