public class Tools extends Object
| Constructor and Description |
|---|
Tools() |
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(File sourceFile,
File destinationFile)
Copy one file into antoher.
|
static void |
copyFromResource(String name,
File destinationFile)
Copies a resource file (in-jar) to a given destination.
|
static List |
enumerationToList(Enumeration enumeration) |
static String |
escapeHTMLUnicode(String s,
boolean javascript)
Escape all non-ASCII character in a UNICODE string.
|
static String |
getFilename(String path)
Extract the file name out of a full path.
|
static String |
join(String[] array,
String separator) |
static String[] |
listToArray(String s,
String separator)
Transform a list into an array.
|
static void |
makeFileDir(File f)
Will create the directories present in the path of a file.
|
static File |
parent(File f)
Get the parent of a given path.
|
static String |
replace(String src,
String token,
String with) |
static Collection |
sort(Collection collection,
Comparator comparator)
Returns a sorted copy of a given collection.
|
static boolean |
startsWithHtmlTag(String txt) |
public static final List HTML_TAGS
public static void copyFromResource(String name, File destinationFile) throws FileCopyException
name - Full path to the resource (relative to the jar though).destinationFile - Where to copy the file.FileCopyExceptionpublic static void copy(File sourceFile, File destinationFile) throws IOException
sourceFile - Source path.destinationFile - Destination path.IOExceptionpublic static File parent(File f)
f - The path.public static Collection sort(Collection collection, Comparator comparator)
collection - Colelction to sort.comparator - Comparator to use while sorting.public static String[] listToArray(String s, String separator)
s - The listseparator - the separator.public static String escapeHTMLUnicode(String s, boolean javascript)
Additionally, this function can escape the single quote character for Javascript strings.
s - String to escape. If null, nothing is done.javascript - If true, escapes the single quote character into
\' so that it can appear in a single quote delimited Javascript
string.public static List enumerationToList(Enumeration enumeration)
public static String getFilename(String path)
path - The full path.public static void makeFileDir(File f) throws IOException
f - The file to get the path from.IOExceptionpublic static boolean startsWithHtmlTag(String txt)
Copyright © 2002-2012 DTDDoc. All Rights Reserved.