@PublicAPI public class Tools extends Object
Constructor and Description |
---|
Tools() |
Modifier and Type | Method and Description |
---|---|
static String[] |
dataSpaceConfigPropertyToUrls(String property)
Parses the given dataspace configuration property to an array of strings
The parsing handles double quotes and space separators
|
static long |
formatDate(String pattern)
Format the given string and return a long that correspond
to the time represented by the given string.
|
static String |
formatNChar(int toFormat,
int nbChar,
char replacement)
Format the given integer 'toFormat' to a String containing 'nbChar'
characters
|
static String |
getElapsedTime(long time) |
static String |
getFormattedDate(long time)
Return the given date as a formatted string.
|
static String |
getFormattedDuration(long start,
long end)
Format 2 long times into a single duration as a String.
|
static String |
getHostURL(String url)
Normalize the given URL into an URL that only contains protocol://host:port/
|
static String |
getStringAsArray(ObjectArrayFormatter oaf)
Get the columned string according to the given ObjectArrayFormatter descriptor.
|
static void |
logAvailableScriptEngines(org.apache.log4j.Logger logger)
Log available script engines at INFO level.
|
static String[] |
parseCommandLine(String cmdLine)
Parse a command line in order to split it into a string array.
|
static long |
parsePeriod(String periodString)
Translates time period string into milliseconds.
|
static String |
shellExtension()
Return the extension of shell script depending the current OS
|
public static String formatNChar(int toFormat, int nbChar, char replacement)
toFormat
- the number to formatnbChar
- the number of characters of the formatted result stringpublic static String getFormattedDuration(long start, long end)
start
- the first date (time)end
- the second date (time)public static String getFormattedDate(long time)
time
- the date as a long.public static String getElapsedTime(long time)
public static long formatDate(String pattern)
0
will be returned.pattern
- a time pattern that must be in [[HH:]MM:]SS
where HH, MM, and SS are numberspublic static String getHostURL(String url)
url
- the url to transformpublic static String[] parseCommandLine(String cmdLine)
This method can be mostlikely used for Runtime.exec(String[]) method.
cmdLine
- The command line to parse.public static String shellExtension()
public static String[] dataSpaceConfigPropertyToUrls(String property)
property
- dataspace configuration propertypublic static String getStringAsArray(ObjectArrayFormatter oaf)
oaf
- the ObjectArrayFormatter describing how to print the array.public static long parsePeriod(String periodString)
public static void logAvailableScriptEngines(org.apache.log4j.Logger logger)
logger
- the logger instance used to log available script engines.