|
PMII - JAVA-Packages - Principia Mathematica II | |||||||||
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.
Method Summary | |
static StringBuffer |
getSpaces(int length)
Get amount of spaces. |
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 |
|
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 occuredpublic 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 occuredpublic 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 occuredpublic 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 occuredpublic 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" String
String
NullPointerException
- if unquoted == null
public 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 replace
replace
- replacement for search
public static final void waitln()
public static final StringBuffer getSpaces(int length)
length
- number of spacesnumber
spaces
|
PMII - JAVA-Packages - Principia Mathematica II | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
©left GNU General Public Licence All Rights Reserved. |