1 /* 2 * $Header: /cvshome/build/org.osgi.service.upnp/src/org/osgi/service/upnp/UPnPIcon.java,v 1.12 2006/07/12 21:21:34 hargrave Exp $ 3 * 4 * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.osgi.service.upnp; 19 20 import java.io.IOException; 21 import java.io.InputStream; 22 23 /** 24 * A UPnP icon representation. 25 * 26 * Each UPnP device can contain zero or more icons. 27 */ 28 public interface UPnPIcon { 29 /** 30 * Returns the MIME type of the icon. 31 * 32 * This method returns the format in which the icon graphics, read from the 33 * <code>InputStream</code> object obtained by the <code>getInputStream()</code> 34 * method, is encoded. 35 * <p> 36 * The format of the returned string is in accordance to RFC2046. A list of 37 * valid MIME types is maintained by the <a 38 * HREF="http://www.iana.org/assignments/media-types/">IANA</a>. 39 * <p> 40 * Typical values returned include: "image/jpeg" or "image/gif" 41 * 42 * @return The MIME type of the encoded icon. 43 */ 44 String getMimeType(); 45 46 /** 47 * Returns the width of the icon in pixels. 48 * 49 * If the actual width of the icon is unknown, -1 is returned. 50 * 51 * @return The width in pixels, or -1 if unknown. 52 */ 53 int getWidth(); 54 55 /** 56 * Returns the height of the icon in pixels. 57 * 58 * If the actual height of the icon is unknown, -1 is returned. 59 * 60 * @return The height in pixels, or -1 if unknown. 61 */ 62 int getHeight(); 63 64 /** 65 * Returns the size of the icon in bytes. 66 * 67 * This method returns the number of bytes of the icon available to read 68 * from the <code>InputStream</code> object obtained by the 69 * <code>getInputStream()</code> method. If the actual size can not be 70 * determined, -1 is returned. 71 * 72 * @return The icon size in bytes, or -1 if the size is unknown. 73 */ 74 int getSize(); 75 76 /** 77 * Returns the color depth of the icon in bits. 78 * 79 * @return The color depth in bits. If the actual color depth of the icon is 80 * unknown, -1 is returned. 81 */ 82 int getDepth(); 83 84 /** 85 * Returns an <code>InputStream</code> object for the icon data. 86 * 87 * The <code>InputStream</code> object provides a way for a client to read the 88 * actual icon graphics data. The number of bytes available from this 89 * <code>InputStream</code> object can be determined via the 90 * <code>getSize()</code> method. The format of the data encoded can be 91 * determined by the MIME type availble via the <code>getMimeType()</code> 92 * method. 93 * 94 * @return An InputStream to read the icon graphics data from. 95 * @throws IOException If the <code>InputStream</code> cannot be returned. 96 * @see UPnPIcon#getMimeType() 97 */ 98 InputStream getInputStream() throws IOException; 99 } 100