org.jaffa.presentation.portlet.widgets.model
Class ImageModel

java.lang.Object
  extended byorg.jaffa.presentation.portlet.widgets.model.WidgetModel
      extended byorg.jaffa.presentation.portlet.widgets.model.ImageModel

public class ImageModel
extends WidgetModel

Model for the Image widget. This will keep the image in memory by default. This can however be modified to store the image in a temporary folder on the filesystem.


Constructor Summary
ImageModel(byte[] image)
          Create a new image model.
ImageModel(byte[] image, String extention)
          Create a new Image Model specifying the image type (if null, GIF is assumed).
 
Method Summary
 void finalize()
          This will ensure that the temporary file (if created) gets deleted.
 String getExtention()
          Getter for property extension (image type).
 byte[] getImage()
          Get the byte array for the image.
 String getImageUrl()
          Returns the URL to access the image relative of the web server.
 String getMimeType()
          Getter for property mimeType.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageModel

public ImageModel(byte[] image)
Create a new image model. The default image type is GIF.

Parameters:
image - The image.

ImageModel

public ImageModel(byte[] image,
                  String extention)
Create a new Image Model specifying the image type (if null, GIF is assumed). Currently suppoted image types are : gif,png,jpeg,jpg,jpe,bmp,tif,tiff. This will throw an IllegalExtensionRuntimeException if any other extention is passed.

Parameters:
image - The image.
extention - The image type.
Method Detail

getMimeType

public String getMimeType()
Getter for property mimeType.

Returns:
Value of property mimeType.

getExtention

public String getExtention()
Getter for property extension (image type).

Returns:
Value of property extension (image type).

getImageUrl

public String getImageUrl()
Returns the URL to access the image relative of the web server.

Returns:
the URL to access the image relative of the web server.

getImage

public byte[] getImage()
                throws IOException
Get the byte array for the image. This may be in-memory, or read in from disk.

Returns:
the byte array for the image.
Throws:
IOException - if any error occurs in reading the image from the filesystem.

finalize

public void finalize()
This will ensure that the temporary file (if created) gets deleted.



Copyright © 2002-2004 JAFFA Project.