Package org.cristalise.kernel.utils
Class FileStringUtility
java.lang.Object
org.cristalise.kernel.utils.FileStringUtility
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendConfigFile(Properties props, String configFile) Load the contents of the configuration filestatic booleanchecks for existing directorystatic Stringstatic booleancreateNewDir(String dirPath) creating a new directorystatic booleandeleting a existing directorystatic booleandeleting a existing directory with its structurestatic Stringfile2String(File file) Reads a file and converts it to Stringstatic Stringfile2String(String fileName) Reads a file and converts it to Stringstatic String[]file2StringArray(File file) Reads a file and converts each line to String[]static String[]file2StringArray(String fileName) Reads a file and converts it to String[]List all file names in the directory recursively, relative to the starting directory.static PropertiesloadConfigFile(String configFile) Load the contents of the configuration fileloadLanguageFile(String configFile) Load the contents of the language filestatic InputStreamopenTextStream(String source) Open a URL or File as an InputStreamstatic Stringreplaceall(String src, String from, String to) static voidstring2File(File file, String data) Saves a string to a text filestatic voidstring2File(String fileName, String data) Saves a string to a text filestatic StringtoAlphaNum(String source) static Stringurl2String(URL location) Reads a file and converts it to String
-
Constructor Details
-
FileStringUtility
public FileStringUtility()
-
-
Method Details
-
file2String
Reads a file and converts it to String- Throws:
FileNotFoundExceptionIOException
-
file2String
Reads a file and converts it to String- Throws:
FileNotFoundExceptionIOException
-
url2String
Reads a file and converts it to String- Throws:
IOException
-
file2StringArray
Reads a file and converts each line to String[]- Throws:
FileNotFoundExceptionIOException
-
file2StringArray
Reads a file and converts it to String[]- Throws:
FileNotFoundExceptionIOException
-
string2File
Saves a string to a text file- Throws:
FileNotFoundExceptionIOException
-
string2File
public static void string2File(String fileName, String data) throws FileNotFoundException, IOException Saves a string to a text file- Throws:
FileNotFoundExceptionIOException
-
checkDir
checks for existing directory -
createNewDir
creating a new directory -
deleteDir
deleting a existing directory -
deleteDir
deleting a existing directory with its structure- Parameters:
dirPath- the directory which should be deletedforce- if true forces to delete the entry (ie. the dirPath) even if it is a filerecursive- if true deletes the complete directory structure
-
listDir
List all file names in the directory recursively, relative to the starting directory.- Parameters:
dirPath- starting directoryrecursive- goes into the subdirectories
-
openTextStream
Open a URL or File as an InputStream- Throws:
IOException
-
loadConfigFile
Load the contents of the configuration file- Throws:
IOException
-
loadLanguageFile
Load the contents of the language file -
appendConfigFile
Load the contents of the configuration file- Throws:
IOException
-
convert
-
replaceall
-
toAlphaNum
-