|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.meyling.principia.io.Utility
A collection of usefull static methods.
| Constructor Summary | |
private |
Utility()
Constructor, should never be called. |
| Method Summary | |
static boolean |
isLetterDigitString(String text)
Tests if given String begins with a letter and contains
only letters and digits. |
static void |
loadFile(File file,
StringBuffer buffer)
Reads contents of a file into a string buffer. |
static String |
loadFile(String filename)
Reads a file and returns the contents as a String. |
static void |
loadFile(String filename,
StringBuffer buffer)
Reads contents of a file into a string buffer. |
static String |
quote(String unquoted)
Quotes a String. |
static String |
replace(String text,
String search,
String replace)
Replaces all occurences of search in text
by replace and returns the result. |
static void |
saveFile(String filename,
String text)
Saves a String in a file. |
static void |
saveFile(String filename,
StringBuffer text)
Saves a String in a file. |
static void |
waitln()
Waits til a '\n' was read from System.in. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
private Utility()
| Method Detail |
public static final String loadFile(String filename)
throws IOException
String.filename - name of the file (could include path)IOException - if a file exception occured
public static final void loadFile(String filename,
StringBuffer buffer)
throws IOException
filename - name of the file (could include path)buffer - buffer to fill with file contentsIOException - if a file exception occured
public static final void loadFile(File file,
StringBuffer buffer)
throws IOException
file - this file will be loadedbuffer - buffer to fill with file contentsIOException - if a file exception occured
public static final void saveFile(String filename,
String text)
throws IOException
String in a file. In case of an IO error
a message is written to System.out.filename - name of the file (could include path)text - data to save in the fileIOException - if a file exception occured
public static final void saveFile(String filename,
StringBuffer text)
throws IOException
String in a file. In case of an IO error
a message is written to System.out.filename - name of the file (could include path)text - data to save in the fileIOException - if a file exception occuredpublic static final String quote(String unquoted)
String. If no quotes exist in the
String, a quote character is appended at the
beginning and the end of the String.unquoted - the ungequoted" StringStringNullPointerException - if unquoted == nullpublic static final boolean isLetterDigitString(String text)
String begins with a letter and contains
only letters and digits.text - test thistext only made of letters and digits and has
a leading letter?NullPointerException - if text == null
public static final String replace(String text,
String search,
String replace)
search in text
by replace and returns the result.text - text to work onsearch - replace this text by replacereplace - replacement for searchpublic static final void waitln()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||