public class ModelUtil extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
ANDROID_EMULATOR
True if this class is executing on an Android emulator runtime.
|
static boolean |
ANDROID_RUNTIME
True if this class is executing on an Android runtime
|
Constructor and Description |
---|
ModelUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
commaToNewline(String s) |
static String[] |
fromCommaSeparatedList(String s)
Converts the comma-separated elements of a string into an array of strings,
unescaping backslashed commas.
|
static String[] |
fromCommaSeparatedList(String s,
boolean unescapeCommas)
Converts the comma-separated elements of a string into an array of strings,
optionally unescaping backslashed commas.
|
static long |
fromTimeString(String s) |
static byte[] |
getFirstNetworkInterfaceHardwareAddress() |
static InetAddress |
getInetAddressByName(String name)
Wraps the checked exception in a runtime exception.
|
static String |
getLocalHostName(boolean includeDomain)
DNS reverse name lookup.
|
static boolean |
isStringConvertibleType(Set<Class> stringConvertibleTypes,
Class clazz) |
static boolean |
isValidUDAName(String name) |
static String |
toCommaSeparatedList(Object[] o)
Converts the given instances into comma-separated elements of a string,
escaping commas with backslashes.
|
static String |
toCommaSeparatedList(Object[] o,
boolean escapeCommas,
boolean escapeDoubleQuotes)
Converts the given instances into comma-separated elements of a string,
optionally escapes commas and double quotes with backslahses.
|
static String |
toTimeString(long seconds) |
public static final boolean ANDROID_RUNTIME
public static final boolean ANDROID_EMULATOR
public static boolean isStringConvertibleType(Set<Class> stringConvertibleTypes, Class clazz)
stringConvertibleTypes
- A collection of interfaces.clazz
- An interface to test.true
if the given interface is an Enum, or if the collection contains a super-interface.public static boolean isValidUDAName(String name)
name
- A UPnP device architecture "name" string.true
if the name is not empty, doesn't start with "xml", and
matches Constants.REGEX_UDA_NAME
.public static InetAddress getInetAddressByName(String name)
public static String toCommaSeparatedList(Object[] o)
public static String toCommaSeparatedList(Object[] o, boolean escapeCommas, boolean escapeDoubleQuotes)
public static String[] fromCommaSeparatedList(String s)
public static String[] fromCommaSeparatedList(String s, boolean unescapeCommas)
public static String toTimeString(long seconds)
seconds
- The number of seconds to convert.11:23:44
public static long fromTimeString(String s)
s
- A string representing hours, minutes, seconds, e.g. 11:23:44
public static String commaToNewline(String s)
s
- A string with commas.public static String getLocalHostName(boolean includeDomain)
includeDomain
- true
if the whole FQDN should be returned, instead of just the first (host) part.public static byte[] getFirstNetworkInterfaceHardwareAddress()
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.