org.fourthline.cling.model.meta
Class Icon

java.lang.Object
  extended by org.fourthline.cling.model.meta.Icon
All Implemented Interfaces:
Validatable

public class Icon
extends Object
implements Validatable

The metadata of a device icon, might include the actual image data of a local icon.

Note that validation of icons is lax on purpose, a valid Icon might still return null from getMimeType(), getWidth(), getHeight(), and getDepth(). However, getUri() will return a valid URI for a valid Icon.

Author:
Christian Bauer

Constructor Summary
protected Icon(org.seamless.util.MimeType mimeType, int width, int height, int depth, URI uri, byte[] data)
           
  Icon(String mimeType, int width, int height, int depth, File file)
          Use this constructor if your local icon data can be resolved with a File, the file's name must be unique within the scope of a device.
  Icon(String mimeType, int width, int height, int depth, String uniqueName, byte[] data)
          Use this constructor if your local icon data is in a byte[].
  Icon(String mimeType, int width, int height, int depth, String uniqueName, InputStream is)
          Use this constructor if your local icon data is an InputStream.
  Icon(String mimeType, int width, int height, int depth, String uniqueName, String binHexEncoded)
          Use this constructor if your local icon is binary data encoded with BinHex.
  Icon(String mimeType, int width, int height, int depth, URI uri)
          Used internally by Cling when RemoteDevice is discovered, you shouldn't have to call this.
  Icon(String mimeType, int width, int height, int depth, URL url)
          Use this constructor if your local icon data can be resolved on the classpath, for example: MyClass.class.getResource("/my/icon.png)
 
Method Summary
 Icon deepCopy()
           
 byte[] getData()
           
 int getDepth()
           
 Device getDevice()
           
 int getHeight()
           
 org.seamless.util.MimeType getMimeType()
           
 URI getUri()
           
 int getWidth()
           
 String toString()
           
 List<ValidationError> validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            URI uri)
Used internally by Cling when RemoteDevice is discovered, you shouldn't have to call this.


Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            URL url)
     throws IOException
Use this constructor if your local icon data can be resolved on the classpath, for example: MyClass.class.getResource("/my/icon.png)

Parameters:
url - A URL of the icon data that can be read with new File(url.toURI()).
Throws:
IOException

Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            File file)
     throws IOException
Use this constructor if your local icon data can be resolved with a File, the file's name must be unique within the scope of a device.

Throws:
IOException

Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            String uniqueName,
            InputStream is)
     throws IOException
Use this constructor if your local icon data is an InputStream.

Parameters:
uniqueName - Must be a valid URI path segment and unique within the scope of a device.
Throws:
IOException

Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            String uniqueName,
            byte[] data)
Use this constructor if your local icon data is in a byte[].

Parameters:
uniqueName - Must be a valid URI path segment and unique within the scope of a device.

Icon

public Icon(String mimeType,
            int width,
            int height,
            int depth,
            String uniqueName,
            String binHexEncoded)
Use this constructor if your local icon is binary data encoded with BinHex.

Parameters:
uniqueName - Must be a valid URI path segment and unique within the scope of a device.
binHexEncoded - The icon bytes encoded as BinHex.

Icon

protected Icon(org.seamless.util.MimeType mimeType,
               int width,
               int height,
               int depth,
               URI uri,
               byte[] data)
Method Detail

getMimeType

public org.seamless.util.MimeType getMimeType()

getWidth

public int getWidth()

getHeight

public int getHeight()

getDepth

public int getDepth()

getUri

public URI getUri()

getData

public byte[] getData()

getDevice

public Device getDevice()

validate

public List<ValidationError> validate()
Specified by:
validate in interface Validatable
Returns:
An empty List if all rules validated properly, otherwise, the detected errors.

deepCopy

public Icon deepCopy()

toString

public String toString()
Overrides:
toString in class Object


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