org.cybergarage.upnp

## Class Icon

- java.lang.Object
- - org.cybergarage.upnp.Icon

-     public class Icon
      extends Object

  Represents a UPnP device icon with its associated metadata and image data.

  This class encapsulates the properties of a UPnP device icon as defined in the UPnP Device Architecture specification. Each icon has properties such as MIME type, width, height, color depth, and URL. The class also supports storing the actual icon image data as a byte array.

  Icons are used by UPnP devices to provide visual representations that can be displayed in control point applications or user interfaces.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ELEM_NAME` XML element name for icon nodes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Icon()` Creates a new Icon with a default XML node structure.
    `Icon(Node node)` Creates an Icon from an existing XML node.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBytes()` Gets the raw image data for this icon.
    `int` | `getDepth()` Gets the color depth of the icon.
    `int` | `getHeight()` Gets the height of the icon.
    `Node` | `getIconNode()` Gets the underlying XML node for this icon.
    `String` | `getMimeType()` Gets the MIME type of the icon.
    `String` | `getURL()` Gets the URL where the icon image can be retrieved.
    `Object` | `getUserData()` Gets the user-defined data associated with this icon.
    `int` | `getWidth()` Gets the width of the icon.
    `boolean` | `hasBytes()` Checks if this icon has raw image data set.
    `boolean` | `hasMimeType()` Checks if the icon has a valid MIME type set.
    `boolean` | `hasURL()` Checks if the icon has a valid URL set.
    `static boolean` | `isIconNode(Node node)` Checks if the given XML node represents an icon.
    `boolean` | `isURL(String url)` Checks if the given URL matches this icon's URL.
    `void` | `setBytes(byte[] data)` Sets the raw image data for this icon.
    `void` | `setDepth(int value)` Sets the color depth of the icon as an integer.
    `void` | `setDepth(String value)` Sets the color depth of the icon as a string.
    `void` | `setHeight(int value)` Sets the height of the icon as an integer.
    `void` | `setHeight(String value)` Sets the height of the icon as a string.
    `void` | `setMimeType(String value)` Sets the MIME type of the icon.
    `void` | `setURL(String value)` Sets the URL where the icon image can be retrieved.
    `void` | `setUserData(Object data)` Sets user-defined data associated with this icon.
    `void` | `setWidth(int value)` Sets the width of the icon as an integer.
    `void` | `setWidth(String value)` Sets the width of the icon as a string.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ELEM_NAME

          public static final String ELEM_NAME

      XML element name for icon nodes.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Icon

          public Icon()

      Creates a new Icon with a default XML node structure.

    - #### Icon

          public Icon(Node node)

      Creates an Icon from an existing XML node.
      Parameters:
        `node` - the XML node containing icon data

  - ### Method Detail

    - #### getBytes

          public byte[] getBytes()

      Gets the raw image data for this icon.
      Returns:
        the byte array containing the icon image data, or null if not set

    - #### getDepth

          public int getDepth()

      Gets the color depth of the icon.
      Returns:
        the color depth in bits per pixel, or 0 if not set or invalid

    - #### getHeight

          public int getHeight()

      Gets the height of the icon.
      Returns:
        the height in pixels, or 0 if not set or invalid

    - #### getIconNode

          public Node getIconNode()

      Gets the underlying XML node for this icon.
      Returns:
        the XML node containing icon data

    - #### getMimeType

          public String getMimeType()

      Gets the MIME type of the icon.
      Returns:
        the MIME type of the icon

    - #### getURL

          public String getURL()

      Gets the URL where the icon image can be retrieved.
      Returns:
        the URL of the icon image

    - #### getUserData

          public Object getUserData()

      Gets the user-defined data associated with this icon.
      Returns:
        the user data object, or null if not set

    - #### getWidth

          public int getWidth()

      Gets the width of the icon.
      Returns:
        the width in pixels, or 0 if not set or invalid

    - #### hasBytes

          public boolean hasBytes()

      Checks if this icon has raw image data set.
      Returns:
        true if image data is available, false otherwise

    - #### hasMimeType

          public boolean hasMimeType()

      Checks if the icon has a valid MIME type set.
      Returns:
        true if a MIME type is set and not empty, false otherwise

    - #### hasURL

          public boolean hasURL()

      Checks if the icon has a valid URL set.
      Returns:
        true if a URL is set and not empty, false otherwise

    - #### isIconNode

          public static boolean isIconNode(Node node)

      Checks if the given XML node represents an icon.
      Parameters:
        `node` - the XML node to check
      Returns:
        true if the node is an icon node, false otherwise

    - #### isURL

          public boolean isURL(String url)

      Checks if the given URL matches this icon's URL.
      Parameters:
        `url` - the URL to compare
      Returns:
        true if the URLs match, false otherwise

    - #### setBytes

          public void setBytes(byte[] data)

      Sets the raw image data for this icon.
      Parameters:
        `data` - the byte array containing the icon image data

    - #### setDepth

          public void setDepth(int value)

      Sets the color depth of the icon as an integer.
      Parameters:
        `value` - the color depth in bits per pixel

    - #### setDepth

          public void setDepth(String value)

      Sets the color depth of the icon as a string.
      Parameters:
        `value` - the color depth as a string

    - #### setHeight

          public void setHeight(int value)

      Sets the height of the icon as an integer.
      Parameters:
        `value` - the height in pixels

    - #### setHeight

          public void setHeight(String value)

      Sets the height of the icon as a string.
      Parameters:
        `value` - the height as a string

    - #### setMimeType

          public void setMimeType(String value)

      Sets the MIME type of the icon.
      Parameters:
        `value` - the MIME type (e.g., "image/png", "image/jpeg")

    - #### setURL

          public void setURL(String value)

      Sets the URL where the icon image can be retrieved.
      Parameters:
        `value` - the URL of the icon image

    - #### setUserData

          public void setUserData(Object data)

      Sets user-defined data associated with this icon.
      Parameters:
        `data` - the user data object to associate

    - #### setWidth

          public void setWidth(int value)

      Sets the width of the icon as an integer.
      Parameters:
        `value` - the width in pixels

    - #### setWidth

          public void setWidth(String value)

      Sets the width of the icon as a string.
      Parameters:
        `value` - the width as a string