Klasse ModelUtil

java.lang.Object
org.jupnp.model.ModelUtil

public class ModelUtil extends Object
Shared trivial procedures.
Autor:
Christian Bauer
  • Felddetails

    • 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.
  • Konstruktordetails

    • ModelUtil

      public ModelUtil()
  • Methodendetails

    • isStringConvertibleType

      public static boolean isStringConvertibleType(Set<Class> stringConvertibleTypes, Class clazz)
      Parameter:
      stringConvertibleTypes - A collection of interfaces.
      clazz - An interface to test.
      Gibt zurück:
      true if the given interface is an Enum, or if the collection contains a super-interface.
    • isValidUDAName

      public static boolean isValidUDAName(String name)
      Parameter:
      name - A UPnP device architecture "name" string.
      Gibt zurück:
      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)
      Parameter:
      seconds - The number of seconds to convert.
      Gibt zurück:
      A string representing hours, minutes, seconds, e.g. 11:23:44
    • fromTimeString

      public static long fromTimeString(String s)
      Parameter:
      s - A string representing hours, minutes, seconds, e.g. 11:23:44
      Gibt zurück:
      The converted number of seconds.
    • commaToNewline

      public static String commaToNewline(String s)
      Parameter:
      s - A string with commas.
      Gibt zurück:
      The same string, a newline appended after every comma.
    • getLocalHostName

      public static String getLocalHostName(boolean includeDomain)
      DNS reverse name lookup.
      Parameter:
      includeDomain - true if the whole FQDN should be returned, instead of just the first (host) part.
      Gibt zurück:
      The resolved host (and domain-) name, or "UNKNOWN HOST" if resolution failed.
    • getFirstNetworkInterfaceHardwareAddress

      public static byte[] getFirstNetworkInterfaceHardwareAddress()
      Gibt zurück:
      The MAC hardware address of the first network interface of this host.