java.lang.Object
org.cybergarage.upnp.device.USN

public class USNextends Object
Utility class for SSDP USN (Unique Service Name) header values and parsing.

This class provides constants and utility methods for handling USN header used in SSDP messages. The USN header provides a unique identifier for devices and services in UPnP networks.

Key features:

  • Root device USN validation
  • UDN (Unique Device Name) extraction
  • USN parsing and manipulation
  • UTF-8 encoding support
  • Null-safe value handling

This class is used by SSDP components to parse and validate USN headers in discovery and advertisement messages, enabling proper device identification and service differentiation in UPnP networks.

  • Field Details

  • Constructor Details

    • USN

      public USN()
      The USN constants and the isRootDevice(String) test below are static, so an instance carries nothing.
  • Method Details

    • isRootDevice

      public static final boolean isRootDevice(String usnValue)
      Tests whether a USN string names the root device.
      Parameters:
      usnValue - a USN string of the form "uuid::upnp:rootdevice"
      Returns:
      true if the value names the root device, false for a null value or another device type
    • getUDN

      public static final String getUDN(String usnValue)
      Extracts the UDN portion of a USN string, the part before the "::" separator.
      Parameters:
      usnValue - a USN string of the form "uuid::<type>"
      Returns:
      the UDN portion before the "::" separator, or the trimmed whole value when there is none