ImageData.this

Constructs an <code>ImageData</code> loaded from the specified input stream. Throws an error if an error occurs while loading the image, or if the image has an unsupported type. Application code is still responsible for closing the input stream. <p> This constructor is provided for convenience when loading a single image only. If the stream contains multiple images, only the first one will be loaded. To load multiple images, use <code>ImageLoader.load()</code>. </p><p> This constructor may be used to load a resource as follows: </p> <pre> static ImageData loadImageData (Class clazz, String string) { InputStream stream = clazz.getResourceAsStream (string); if (stream is null) return null; ImageData imageData = null; try { imageData = new ImageData (stream); } catch (SWTException ex) { } finally { try { stream.close (); } catch (IOException ex) {} } return imageData; } </pre>

@param stream the input stream to load the image from (must not be null)

@exception IllegalArgumentException <ul> <li>ERROR_NULL_ARGUMENT - if the stream is null</li> </ul> @exception SWTException <ul> <li>ERROR_IO - if an IO error occurs while reading from the stream</li> <li>ERROR_INVALID_IMAGE - if the image stream contains invalid data</li> <li>ERROR_UNSUPPORTED_FORMAT - if the image stream contains an unrecognized format</li> </ul>

@see ImageLoader#load(InputStream)

Meta