|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.ExhibitThumbnails.Thumbnail
public static final class ExhibitThumbnails.Thumbnail
Immutable, Serializable single thumbnail (standard or small). Implements hashCode() and equals(), with equals() meaning dimensional and byte-for-byte equality.
| Field Summary | |
|---|---|
private byte[] |
data
Thumbnail raw data; non-null, non-zero-length. |
private byte[] |
hashMD5
The MD5 hash of the thumbnail data (16 bytes), or null. |
private static java.io.ObjectStreamField[] |
serialPersistentFields
Mark all mutable members as unshared for safety. |
private static long |
serialVersionUID
Unique serialisation version number. |
private java.awt.Dimension |
xyDim
Image width and height for image thumbnail, both strictly positive or whole object null. |
| Constructor Summary | |
|---|---|
ExhibitThumbnails.Thumbnail(byte[] _data,
java.awt.Dimension _xyDim)
Construct an image thumbnail with x,y dimensions and a byte array. |
|
| Method Summary | |
|---|---|
private byte[] |
_computeMD5Hash(byte[] d)
Compute the MD5 hash of the supplied data; never null. |
boolean |
equals(java.lang.Object obj)
For equality the thumbnails must be indistinguishable. |
byte[] |
getMD5Hash()
Get the MD5 hash of the thumbnail data; never null. |
java.awt.Dimension |
getXyDim()
Get XxY dimension of thumbnail, or null if not appropriate. |
int |
hashCode()
The hash code is based on things we can compute very quickly. |
boolean |
hasMD5Hash()
True iff this thumbnail has a precomputed MD5hash stored. |
private void |
readObject(java.io.ObjectInputStream in)
Deserialise. |
int |
size()
Return size of data array. |
byte[] |
toByteArrray()
Get data as a (copied) byte[]. |
java.lang.String |
toString()
Human-readable summary. |
void |
validateObject()
Validate fields/state. |
void |
writeData(java.io.OutputStream os)
Write data to a stream, avoiding an unnecessary copy in many cases. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final java.io.ObjectStreamField[] serialPersistentFields
private final byte[] data
private final java.awt.Dimension xyDim
private final byte[] hashMD5
This may also be null when deserialised from an old instance before we computed and stored this value.
private static final long serialVersionUID
| Constructor Detail |
|---|
public ExhibitThumbnails.Thumbnail(byte[] _data,
java.awt.Dimension _xyDim)
Both arguments are copied and are not altered.
| Method Detail |
|---|
public int size()
public byte[] toByteArrray()
public void writeData(java.io.OutputStream os)
throws java.io.IOException
os - (safe) OutputStream on which to write the binary data;
never null
java.io.IOException - if thrown by ospublic java.awt.Dimension getXyDim()
public int hashCode()
We could use the height and width, but we assume that they may not be very effective in distinguishing between thumbnails as they may be constrained to be fixed in one dimension or the other.
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean hasMD5Hash()
If false then this instance has reduced protection against data corruption.
public byte[] getMD5Hash()
private byte[] _computeMD5Hash(byte[] d)
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void validateObject()
throws java.io.InvalidObjectException
This only checks that this is good as a standard thumbnail: extra checking may have to be imposed elsewhere for a small thumbnail.
Barf if something bad is found. (Maybe allow some extra info in debug version.)
validateObject in interface java.io.ObjectInputValidationjava.io.InvalidObjectException
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||