public class FileStringUtility extends Object
| Constructor and Description |
|---|
FileStringUtility() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendConfigFile(Properties props,
String configFile)
Load the contents of the configuration file
|
static boolean |
checkDir(String dirPath)
checks for existing directory
|
static String |
convert(String init) |
static boolean |
createNewDir(String dirPath)
creating a new directory
|
static boolean |
deleteDir(String dirPath)
deleting a existing directory
|
static boolean |
deleteDir(String dirPath,
boolean force,
boolean recursive)
deleting a existing directory with its structure
|
static String |
file2String(File file)
Reads a file and converts it to String
|
static String |
file2String(String fileName)
Reads a file and converts it to String
|
static 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[]
|
static ArrayList<String> |
listDir(String dirPath,
boolean withDirs,
boolean recursive)
List all file names in the directory recursively, relative to the starting directory.
|
static Properties |
loadConfigFile(String configFile)
Load the contents of the configuration file
|
static Hashtable<String,String> |
loadLanguageFile(String configFile)
Load the contents of the language file
|
static InputStream |
openTextStream(String source)
Open a URL or File as an InputStream
|
static String |
replaceall(String src,
String from,
String to) |
static void |
string2File(File file,
String data)
Saves a string to a text file
|
static void |
string2File(String fileName,
String data)
Saves a string to a text file
|
static String |
toAlphaNum(String source) |
static String |
url2String(URL location)
Reads a file and converts it to String
|
public static String file2String(File file) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String file2String(String fileName) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String url2String(URL location) throws IOException
IOExceptionpublic static String[] file2StringArray(File file) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static String[] file2StringArray(String fileName) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static void string2File(File file, String data) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static void string2File(String fileName, String data) throws FileNotFoundException, IOException
FileNotFoundExceptionIOExceptionpublic static boolean checkDir(String dirPath)
public static boolean createNewDir(String dirPath)
public static boolean deleteDir(String dirPath)
public static boolean deleteDir(String dirPath, boolean force, boolean recursive)
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 structurepublic static ArrayList<String> listDir(String dirPath, boolean withDirs, boolean recursive)
dirPath - starting directoryrecursive - goes into the subdirectoriespublic static InputStream openTextStream(String source) throws IOException
IOExceptionpublic static Properties loadConfigFile(String configFile) throws IOException
IOExceptionpublic static Hashtable<String,String> loadLanguageFile(String configFile)
public static void appendConfigFile(Properties props, String configFile) throws IOException
IOExceptionCopyright © 1997–2020 CRISTAL-iSE. All rights reserved.