Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.fourthline.cling.model
Class ModelUtil

    java.lang.Object
      org.fourthline.cling.model.ModelUtil

    public class ModelUtil

extends Object

Shared trivial procedures.

Author:
  Christian Bauer

Field Summary
`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 Summary
`ModelUtil()`

Method Summary
`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)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ANDROID_RUNTIME

    public static final boolean ANDROID_RUNTIME

  True if this class is executing on an Android runtime

### ANDROID_EMULATOR

    public static final boolean ANDROID_EMULATOR

  True if this class is executing on an Android emulator runtime.

Constructor Detail

### ModelUtil

    public ModelUtil()

Method Detail

### isStringConvertibleType

    public static boolean isStringConvertibleType(Set<Class> stringConvertibleTypes,
                                                  Class clazz)

  Parameters:
    `stringConvertibleTypes` - A collection of interfaces.
    `clazz` - An interface to test.
  Returns:
    `true` if the given interface is an Enum, or if the collection contains a super-interface.

### isValidUDAName

    public static boolean isValidUDAName(String name)

  Parameters:
    `name` - A UPnP device architecture "name" string.
  Returns:
    `true` if the name is not empty, doesn't start with "xml", and matches `Constants.REGEX_UDA_NAME`.

### getInetAddressByName

    public static InetAddress getInetAddressByName(String name)

  Wraps the checked exception in a runtime exception.

### toCommaSeparatedList

    public static String toCommaSeparatedList(Object[] o)

  Converts the given instances into comma-separated elements of a string, escaping commas with backslashes.

### toCommaSeparatedList

    public 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.

### fromCommaSeparatedList

    public static String[] fromCommaSeparatedList(String s)

  Converts the comma-separated elements of a string into an array of strings, unescaping backslashed commas.

### fromCommaSeparatedList

    public static String[] fromCommaSeparatedList(String s,
                                                  boolean unescapeCommas)

  Converts the comma-separated elements of a string into an array of strings, optionally unescaping backslashed commas.

### toTimeString

    public static String toTimeString(long seconds)

  Parameters:
    `seconds` - The number of seconds to convert.
  Returns:
    A string representing hours, minutes, seconds, e.g. `11:23:44`

### fromTimeString

    public static long fromTimeString(String s)

  Parameters:
    `s` - A string representing hours, minutes, seconds, e.g. `11:23:44`
  Returns:
    The converted number of seconds.

### commaToNewline

    public static String commaToNewline(String s)

  Parameters:
    `s` - A string with commas.
  Returns:
    The same string, a newline appended after every comma.

### getLocalHostName

    public static String getLocalHostName(boolean includeDomain)

  DNS reverse name lookup.

  Parameters:
    `includeDomain` - `true` if the whole FQDN should be returned, instead of just the first (host) part.
  Returns:
    The resolved host (and domain-) name, or "UNKNOWN HOST" if resolution failed.

### getFirstNetworkInterfaceHardwareAddress

    public static byte[] getFirstNetworkInterfaceHardwareAddress()

  Returns:
    The MAC hardware address of the first network interface of this host.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.