public class Icon extends Object
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.
| Modifier and Type | Field and Description |
|---|---|
static String |
ELEM_NAME
XML element name for icon nodes.
|
| 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.
|
| 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.
|
public static final String ELEM_NAME
public Icon()
public Icon(Node node)
node - the XML node containing icon datapublic byte[] getBytes()
public int getDepth()
public int getHeight()
public Node getIconNode()
public String getMimeType()
public String getURL()
public Object getUserData()
public int getWidth()
public boolean hasBytes()
public boolean hasMimeType()
public boolean hasURL()
public static boolean isIconNode(Node node)
node - the XML node to checkpublic boolean isURL(String url)
url - the URL to comparepublic void setBytes(byte[] data)
data - the byte array containing the icon image datapublic void setDepth(int value)
value - the color depth in bits per pixelpublic void setDepth(String value)
value - the color depth as a stringpublic void setHeight(int value)
value - the height in pixelspublic void setHeight(String value)
value - the height as a stringpublic void setMimeType(String value)
value - the MIME type (e.g., "image/png", "image/jpeg")public void setURL(String value)
value - the URL of the icon imagepublic void setUserData(Object data)
data - the user data object to associatepublic void setWidth(int value)
value - the width in pixelspublic void setWidth(String value)
value - the width as a string