|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.mgmt.EntityImpl
com.antelmann.imagedb.ImageHolder
public class ImageHolder
ImageHolder serves as a wrapper for image information stored in a database.
| Nested Class Summary | |
|---|---|
static class |
ImageHolder.Field
|
| Field Summary | |
|---|---|
protected static String |
defaultType
defaults to png |
| Fields inherited from class com.antelmann.mgmt.EntityImpl |
|---|
propertyChangeSupport, props |
| Constructor Summary | |
|---|---|
ImageHolder()
convenience constructor; id will be 0 |
|
ImageHolder(Integer id)
time is automatically set to current system time |
|
ImageHolder(Integer id,
ImageHolder ih)
|
|
| Method Summary | |
|---|---|
void |
clear()
resets all fields except id; all retrieved fields are also set to false (except for id) |
void |
clearProperties()
|
Date |
getDate()
|
String |
getDescription()
|
Integer |
getID()
returns the immutable id that is used for checking equality |
BufferedImage |
getImage()
first, the internal buffer is checked; only if this is null, the URL will be checked. |
byte[] |
getRawImage()
returns a copy of the raw data |
byte[] |
getRawThumbnail()
returns a copy of the raw data |
BufferedImage |
getThumbnail()
|
long |
getTime()
|
String |
getTitle()
|
String |
getType()
defaults to png. |
URL |
getURL()
|
ImageHolder |
insertInto(ImageDB db)
inserts the image to the given database. |
boolean |
isRetrieved(ImageHolder.Field field)
determines whether the given field value has already been retrieved, if the ImageHolder is read from a database. |
void |
loadFromFile(File file)
convenience method that also puts various attributes into this ImageHolder |
void |
retrieve(ImageDB db)
retrieves all available info on this ImageHolder from the database |
void |
retrieve(ImageDB db,
ImageHolder.Field... fields)
retrieves only the given fields from the database |
void |
saveToFile(File file)
convenience method |
void |
setDescription(String description)
|
void |
setImage(Image image)
stores the data in the configured type format |
void |
setImage(InputStream stream)
directly puts the input stream into this object as raw data; the type value is not affected when using this method. |
protected void |
setRetrieved(ImageHolder.Field field,
boolean flag)
|
void |
setThumbnail(Image image)
|
void |
setThumbnail(InputStream stream)
directly puts the input stream into this object as raw data; the type value is not affected when using this method. |
void |
setThumbnail(int width,
int height)
updates the thumbnail based on the return value of getImage(). |
void |
setTime(Date date)
|
void |
setTime(long timeInMillis)
|
void |
setTitle(String title)
|
void |
setType(String type)
determines the format in which an image is stored. |
void |
setURL(URL url)
|
void |
store(ImageDB db)
stores the ImageHolder to the given database. |
String |
toString()
|
| Methods inherited from class com.antelmann.mgmt.EntityImpl |
|---|
addPropertyChangeListener, checkPropertyChange, containsPropertyText, enableChangeListenerSupport, equals, equalWithProperties, getProperties, getProperty, getPropertyChangeListeners, hashCode, isChangeListenerSupportEnabled, removeProperty, removePropertyChangeListener, setAll, setProperty, verifyProperties |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static String defaultType
| Constructor Detail |
|---|
public ImageHolder()
public ImageHolder(Integer id)
public ImageHolder(Integer id,
ImageHolder ih)
| Method Detail |
|---|
public Integer getID()
EntityImpl
getID in interface ResourcegetID in class EntityImplpublic void clearProperties()
public boolean isRetrieved(ImageHolder.Field field)
ImageDB
protected void setRetrieved(ImageHolder.Field field,
boolean flag)
public void clear()
public String toString()
toString in class Objectpublic String getTitle()
public void setTitle(String title)
public String getType()
setType(String)public void setType(String type)
public URL getURL()
public void setURL(URL url)
public Date getDate()
public long getTime()
public void setTime(long timeInMillis)
public void setTime(Date date)
public String getDescription()
public void setDescription(String description)
public void setThumbnail(int width,
int height)
throws IOException
getImage().
If either width or height is a negative number then a value is substituted
to maintain the aspect ratio of the original image dimensions.
If both width and height are negative, then the original image dimensions are used.
The thumbnail will be created using jpeg encoding.
Before calling this method, an image must have been set.
IOExceptiongetImage()
public void setImage(InputStream stream)
throws IOException
IOException
public void setThumbnail(InputStream stream)
throws IOException
IOException
public void setImage(Image image)
throws IOException
IOException
public void setThumbnail(Image image)
throws IOException
IOException
public BufferedImage getThumbnail()
throws IOException
IOExceptionpublic byte[] getRawImage()
public byte[] getRawThumbnail()
public BufferedImage getImage()
throws IOException
IOException
public void saveToFile(File file)
throws IOException
IOException
public void loadFromFile(File file)
throws IOException
IOException
public ImageHolder insertInto(ImageDB db)
throws DatabaseException
DatabaseExceptionImageDB.insert(ImageHolder)
public void store(ImageDB db)
throws DatabaseException
DatabaseExceptionImageDB.store(ImageHolder, ImageHolder.Field...)
public void retrieve(ImageDB db)
throws DatabaseException
DatabaseException
public void retrieve(ImageDB db,
ImageHolder.Field... fields)
throws DatabaseException
DatabaseException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||