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.
-
content
- Actual content.
-
contentLength
- Size of content.
-
pictureName
- User's name for picture.
-
resourceName
- Name of resource file.
-
Picture(String, String)
- Instantiates the object.
-
display()
- displaying a picture consists of displaying it in a frame.
-
getContent()
- Returns the content.
-
getContentLength()
- Returns the length of the content.
-
getName()
- Returns the resourceName.
-
getPictureName()
- Returns the name of the picture.
-
setContent()
- Opens the resource and checks its size.
resourceName
public String resourceName
- Name of resource file.
pictureName
public String pictureName
- User's name for picture.
contentLength
public int contentLength
- Size of content.
content
public byte content[]
- Actual content.
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
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
getName
public String getName()
- Returns the resourceName.
getPictureName
public String getPictureName()
- Returns the name of the picture.
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.
getContentLength
public int getContentLength()
- Returns the length of the content.
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