public class Utils
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static java.lang.Object |
DEL |
|
static java.lang.String |
NL |
Constructor | Description |
---|---|
Utils() |
Modifier and Type | Method | Description |
---|---|---|
static java.lang.String |
capitalize(java.lang.String string) |
Capitalize the first characters to upper case
|
static java.lang.String |
cleanHtmlEscapes(java.lang.String str) |
Replaces the escaped html characters whith the proper characters
|
static boolean |
containsAny(java.util.Collection fields,
java.util.Collection any) |
Returns true if at least 1 field in any is contained in fields
|
static java.io.File |
createTempFile(java.lang.String str) |
Writes the string to a temporary file
|
static java.lang.String |
escapeCSV(java.lang.String value) |
Escapes a CSV value so that we handle text which contains " and new lines correctly
|
static java.lang.String |
getDestinationFolder() |
Determines the data folder
|
static java.lang.String |
getProperty(java.lang.String property,
java.lang.String defaultValue) |
Returns the indicated environment variable or if it does not exist the system
property.
|
static boolean |
isEmpty(java.lang.String str) |
Checks if the string is empty (empty string or null)
|
static java.lang.Boolean |
isNumber(java.lang.String str,
java.lang.Boolean resultIfEmpty) |
Return true if the str is a number
|
static java.lang.String |
lastPath(java.lang.String url) |
Returns the last part of a string after any of the following delimiting
characters (_,#,/,:)
|
static java.lang.String |
lastPath(java.lang.String url,
java.lang.String delim) |
|
static java.lang.String |
notNull(java.lang.Object value,
java.lang.String defaultValue) |
Converts a null string to an defaultValue - otherwise the input is returned
|
static java.lang.String |
notNull(java.lang.String value) |
Converts a null string to an empty spaces - otherwise the input is returned
|
static java.lang.String |
repeat(java.lang.String s,
int n) |
Creates a string by repeating the input string n times
|
static java.lang.String |
runtime(java.lang.String context,
long start) |
Collect the runtime
|
static void |
setCSVDelimiter(java.lang.String del) |
Defines the CSV Delimiter
|
static java.lang.String |
str(java.lang.Object value) |
Makes sure that we do not have any null.
|
static java.lang.String |
toString(java.util.Collection filterValues,
java.lang.String stringDel,
java.lang.String delimiter) |
Convert collection to String
|
static java.io.ByteArrayOutputStream |
urlToByteArray(java.net.URL url) |
Converts a URL to a ByteArrayOutputStream
|
static void |
waitForever() |
Executes repeated thread sleep for 1 minutue
|
static long |
wordCount(java.lang.String str,
java.lang.String findStr) |
Count the occurrences of the findString
|
public static final java.lang.String NL
public static java.lang.Object DEL
public static boolean isEmpty(java.lang.String str)
str
- String with or without valuepublic static java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue)
property
- property namedefaultValue
- value if no property is definedpublic static java.lang.String lastPath(java.lang.String url)
url
- public static java.lang.String lastPath(java.lang.String url, java.lang.String delim)
public static java.lang.String notNull(java.lang.String value)
value
- public static java.lang.String notNull(java.lang.Object value, java.lang.String defaultValue)
value
- defaultValue
- public static java.lang.String repeat(java.lang.String s, int n)
s
- input stringn
- public static void waitForever() throws java.lang.InterruptedException
java.lang.InterruptedException
public static boolean containsAny(java.util.Collection fields, java.util.Collection any)
fields
- any
- public static java.lang.String toString(java.util.Collection filterValues, java.lang.String stringDel, java.lang.String delimiter)
filterValues
- stringDel
- delimiter
- public static long wordCount(java.lang.String str, java.lang.String findStr)
str
- findStr
- public static java.lang.String capitalize(java.lang.String string)
string
- public static java.lang.String runtime(java.lang.String context, long start)
context
- start
- public static java.lang.Boolean isNumber(java.lang.String str, java.lang.Boolean resultIfEmpty)
str
- resultIfEmpty
- public static java.lang.String str(java.lang.Object value)
value
- public static java.io.ByteArrayOutputStream urlToByteArray(java.net.URL url) throws java.io.IOException
url
- java.io.IOException
public static java.io.File createTempFile(java.lang.String str) throws java.io.IOException
str
- java.io.IOException
public static void setCSVDelimiter(java.lang.String del)
del
- public static java.lang.String escapeCSV(java.lang.String value)
value
- public static java.lang.String cleanHtmlEscapes(java.lang.String str)
str
- public static java.lang.String getDestinationFolder()