public abstract class Directory
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected java.util.List |
_definedTagList
A convenient list holding tag values in the order in which they were stored.
|
protected TagDescriptor |
_descriptor
The descriptor used to interperet tag values.
|
protected java.util.HashMap |
_tagMap
Map of values hashed by type identifiers.
|
Constructor and Description |
---|
Directory()
Creates a new Directory.
|
Modifier and Type | Method and Description |
---|---|
void |
addError(java.lang.String message) |
boolean |
containsTag(int tagType)
Indicates whether the specified tag type has been set.
|
boolean |
getBoolean(int tagType)
Returns the specified tag's value as a boolean, if possible.
|
byte[] |
getByteArray(int tagType)
Gets the specified tag's value as an byte array, if possible.
|
java.util.Date |
getDate(int tagType)
Returns the specified tag's value as a java.util.Date, if possible.
|
java.lang.String |
getDescription(int tagType)
Provides a description of a tag's value using the descriptor set by
setDescriptor(Descriptor) . |
double |
getDouble(int tagType)
Returns the specified tag's value as a double, if possible.
|
int |
getErrorCount() |
java.util.Iterator |
getErrors() |
float |
getFloat(int tagType)
Returns the specified tag's value as a float, if possible.
|
int |
getInt(int tagType)
Returns the specified tag's value as an int, if possible.
|
int[] |
getIntArray(int tagType)
Gets the specified tag's value as an int array, if possible.
|
long |
getLong(int tagType)
Returns the specified tag's value as a long, if possible.
|
abstract java.lang.String |
getName()
Provides the name of the directory, for display purposes.
|
java.lang.Object |
getObject(int tagType)
Returns the object hashed for the particular tag type specified, if available.
|
Rational |
getRational(int tagType)
Returns the specified tag's value as a Rational, if possible.
|
Rational[] |
getRationalArray(int tagType) |
java.lang.String |
getString(int tagType)
Returns the specified tag's value as a String.
|
java.lang.String[] |
getStringArray(int tagType)
Gets the specified tag's value as a String array, if possible.
|
int |
getTagCount()
Returns the number of tags set in this Directory.
|
java.util.Iterator |
getTagIterator()
Returns an Iterator of Tag instances that have been set in this Directory.
|
java.lang.String |
getTagName(int tagType)
Returns the name of a specified tag as a String.
|
protected abstract java.util.HashMap |
getTagNameMap()
Provides the map of tag names, hashed by tag type identifier.
|
boolean |
hasErrors() |
void |
setBoolean(int tagType,
boolean value)
Sets an int value for the specified tag.
|
void |
setByteArray(int tagType,
byte[] bytes)
Sets a byte array for the specified tag.
|
void |
setDate(int tagType,
java.util.Date value)
Sets a java.util.Date value for the specified tag.
|
void |
setDescriptor(TagDescriptor descriptor)
Sets the descriptor used to interperet tag values.
|
void |
setDouble(int tagType,
double value)
Sets a double value for the specified tag.
|
void |
setFloat(int tagType,
float value)
Sets a float value for the specified tag.
|
void |
setInt(int tagType,
int value)
Sets an int value for the specified tag.
|
void |
setIntArray(int tagType,
int[] ints)
Sets an int array for the specified tag.
|
void |
setLong(int tagType,
long value)
Sets a long value for the specified tag.
|
void |
setObject(int tagType,
java.lang.Object value)
Private helper method, containing common functionality for all 'add'
methods.
|
void |
setObjectArray(int tagType,
java.lang.Object array)
Private helper method, containing common functionality for all 'add...Array'
methods.
|
void |
setRational(int tagType,
Rational rational)
Sets a Rational value for the specified tag.
|
void |
setRationalArray(int tagType,
Rational[] rationals)
Sets a Rational array for the specified tag.
|
void |
setString(int tagType,
java.lang.String value)
Sets an int value for the specified tag.
|
void |
setStringArray(int tagType,
java.lang.String[] strings)
Sets a String array for the specified tag.
|
protected final java.util.HashMap _tagMap
protected TagDescriptor _descriptor
protected final java.util.List _definedTagList
public abstract java.lang.String getName()
Exif
protected abstract java.util.HashMap getTagNameMap()
public boolean containsTag(int tagType)
tagType
- the tag type to check forpublic java.util.Iterator getTagIterator()
public int getTagCount()
public void setDescriptor(TagDescriptor descriptor)
descriptor
- the descriptor used to interperet tag valuespublic void addError(java.lang.String message)
public boolean hasErrors()
public java.util.Iterator getErrors()
public int getErrorCount()
public void setInt(int tagType, int value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as an intpublic void setDouble(int tagType, double value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a doublepublic void setFloat(int tagType, float value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a floatpublic void setString(int tagType, java.lang.String value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a Stringpublic void setBoolean(int tagType, boolean value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a booleanpublic void setLong(int tagType, long value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a longpublic void setDate(int tagType, java.util.Date value)
tagType
- the tag's value as an intvalue
- the value for the specified tag as a java.util.Datepublic void setRational(int tagType, Rational rational)
tagType
- the tag's value as an intrational
- rational numberpublic void setRationalArray(int tagType, Rational[] rationals)
tagType
- the tag identifierrationals
- the Rational array to storepublic void setIntArray(int tagType, int[] ints)
tagType
- the tag identifierints
- the int array to storepublic void setByteArray(int tagType, byte[] bytes)
tagType
- the tag identifierbytes
- the byte array to storepublic void setStringArray(int tagType, java.lang.String[] strings)
tagType
- the tag identifierstrings
- the String array to storepublic void setObject(int tagType, java.lang.Object value)
tagType
- the tag's value as an intvalue
- the value for the specified tagjava.lang.NullPointerException
- if value is null
public void setObjectArray(int tagType, java.lang.Object array)
tagType
- the tag's value as an intarray
- the array of values for the specified tagpublic int getInt(int tagType) throws MetadataException
MetadataException
public java.lang.String[] getStringArray(int tagType) throws MetadataException
tagType
- the tag identifierMetadataException
- if the tag has not been set or cannot be represented
as a String[]public int[] getIntArray(int tagType) throws MetadataException
tagType
- the tag identifierMetadataException
- if the tag has not been set, or cannot be converted to
an int arraypublic byte[] getByteArray(int tagType) throws MetadataException
tagType
- the tag identifierMetadataException
- if the tag has not been set, or cannot be converted to
a byte arraypublic double getDouble(int tagType) throws MetadataException
MetadataException
public float getFloat(int tagType) throws MetadataException
MetadataException
public long getLong(int tagType) throws MetadataException
MetadataException
public boolean getBoolean(int tagType) throws MetadataException
MetadataException
public java.util.Date getDate(int tagType) throws MetadataException
MetadataException
public Rational getRational(int tagType) throws MetadataException
MetadataException
public Rational[] getRationalArray(int tagType) throws MetadataException
MetadataException
public java.lang.String getString(int tagType)
null
if the tag hasn't been defined.public java.lang.Object getObject(int tagType)
tagType
- the tag type identifierpublic java.lang.String getTagName(int tagType)
tagType
- the tag type identifierpublic java.lang.String getDescription(int tagType) throws MetadataException
setDescriptor(Descriptor)
.tagType
- the tag type identifierMetadataException
- if a descriptor hasn't been set, or if an error
occurs during calculation of the description within the DescriptorCopyright © 2006 Drew Noakes. All Rights Reserved.