public abstract class Tools extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copyDirectory(File src,
File dst)
Copies the specified directory path. Use with great caution since
no attempt is made to check for symbolic links, which could result in
copy of unintended files.
|
static void |
copyDirectory(String src,
String dst)
Copies the specified directory path. Use with great caution since
no attempt is made to check for symbolic links, which could result in
copy of unintended files.
|
static void |
delay(int ms)
Suspends the current thread for a specified number of millis.
|
static long |
fromHex(String string)
Converts a string from hex to long.
|
static String |
get(Dictionary<?,?> properties,
String propertyName)
Get property as a string value.
|
static ThreadFactory |
groupedThreads(String groupName,
String pattern)
Returns a thread factory that produces threads named according to the
supplied name pattern and from the specified thread-group.
|
static boolean |
isNullOrEmpty(Collection collection)
Returns true if the collection is null or is empty.
|
static ThreadFactory |
minPriority(ThreadFactory factory)
Returns a thread factory that produces threads with MIN_PRIORITY.
|
static ThreadFactory |
namedThreads(String pattern)
Returns a thread factory that produces threads named according to the
supplied name pattern.
|
static void |
removeDirectory(File dir)
Purges the specified directory path. Use with great caution since
no attempt is made to check for symbolic links, which could result in
deletion of unintended files.
|
static void |
removeDirectory(String path)
Purges the specified directory path. Use with great caution since
no attempt is made to check for symbolic links, which could result in
deletion of unintended files.
|
static List<String> |
slurp(File path)
Slurps the contents of a file into a list of strings, one per line.
|
static String |
timeAgo(long unixTime)
Returns a human friendly time ago string for a specified system time.
|
static String |
toHex(long value)
Converts a long value to hex string; 16 wide and sans 0x.
|
static String |
toHex(long value,
int width)
Converts a long value to hex string; 16 wide and sans 0x.
|
public static ThreadFactory namedThreads(String pattern)
pattern - name patternpublic static ThreadFactory groupedThreads(String groupName, String pattern)
onos/intent. The thread names will be produced by converting
the thread group name into dash-delimited format and pre-pended to the
specified pattern.groupName - group name in slash-delimited format to indicate hierarchypattern - name patternpublic static ThreadFactory minPriority(ThreadFactory factory)
factory - backing ThreadFactorypublic static boolean isNullOrEmpty(Collection collection)
collection - collection to testpublic static long fromHex(String string)
string - hex number in string form; sans 0xpublic static String toHex(long value)
value - long valuepublic static String toHex(long value, int width)
value - long valuewidth - string width; zero paddedpublic static String get(Dictionary<?,?> properties, String propertyName)
properties - properties to be looked uppropertyName - the name of the property to look uppublic static void delay(int ms)
ms - number of millispublic static List<String> slurp(File path)
path - file pathpublic static void removeDirectory(String path) throws IOException
path - directory to be removedIOException - if unable to remove contentspublic static void removeDirectory(File dir) throws IOException
dir - directory to be removedIOException - if unable to remove contentspublic static String timeAgo(long unixTime)
unixTime - system time in millispublic static void copyDirectory(String src, String dst) throws IOException
src - directory to be copieddst - destination directory to be removedIOException - if unable to remove contentspublic static void copyDirectory(File src, File dst) throws IOException
src - directory to be copieddst - destination directory to be removedIOException - if unable to remove contentsCopyright © 2015. All rights reserved.