All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.serializabletypes.Picture

java.lang.Object
   |
   +----JBMSTours.serializabletypes.Picture

public class Picture
extends Object
implements Serializable
Look at the Source.

Defines a class containing a picture. When the class is instantiated, it tries to open a resource and store it as a byte array in the content field. See PictureURL for an example of doing the same thing with a URL, not a resource.


Variable Index

 o content
Actual content.
 o contentLength
Size of content.
 o pictureName
User's name for picture.
 o resourceName
Name of resource file.

Constructor Index

 o Picture(String, String)
Instantiates the object.

Method Index

 o display()
displaying a picture consists of displaying it in a frame.
 o getContent()
Returns the content.
 o getContentLength()
Returns the length of the content.
 o getName()
Returns the resourceName.
 o getPictureName()
Returns the name of the picture.
 o setContent()
Opens the resource and checks its size.

Variables

 o resourceName
 public String resourceName
Name of resource file.

 o pictureName
 public String pictureName
User's name for picture.

 o contentLength
 public int contentLength
Size of content.

 o content
 public byte content[]
Actual content.

Constructors

 o Picture
 public Picture(String rname,
                String pname) throws Exception
Instantiates the object. Most of the work is done in setContent.

Parameters:
rname - resourcename for the source resource
pname - your name for the picture
Throws: Exception
if there is a problem reading the source

Methods

 o setContent
 protected void setContent() throws Exception
Opens the resource and checks its size. If the resource is below MAXSIZE, it reads the contents directly into the class. If the object is being instantiated within Cloudscape, this has the effect of storing the URL content along with the rest of the object in the database.

Throws: Exception
if there is a problem reading the source
 o getName
 public String getName()
Returns the resourceName.

 o getPictureName
 public String getPictureName()
Returns the name of the picture.

 o getContent
 public byte[] getContent()
Returns the content. If the content is local, this method simply returns the array reference. If not, we open the URL and read from it. Notice that this stores the content in memory, so that if someone asks for it again we already have it.

 o getContentLength
 public int getContentLength()
Returns the length of the content.

 o display
 public void display() throws Exception
displaying a picture consists of displaying it in a frame.

Throws: Exception
If there is an error.

All Packages  Class Hierarchy  This Package  Previous  Next  Index