Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.drew.metadata
Class Directory  view Directory download Directory.java

java.lang.Object
  extended bycom.drew.metadata.Directory
All Implemented Interfaces:
java.io.Serializable

public abstract class Directory
extends java.lang.Object
implements java.io.Serializable

Base class for all Metadata directory types with supporting methods for setting and getting tag values.


Field Summary
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.
private  java.util.List _errorList
           
protected  java.util.HashMap _tagMap
          Map of values hashed by type identifiers.
 
Constructor Summary
Directory()
          Creates a new Directory.
 
Method Summary
 void addError(java.lang.String message)
           
private  void addObject(int tagType, java.lang.Object value)
          Private helper method, containing common functionality for all 'add' methods.
private  void addObjectArray(int tagType, java.lang.Object array)
          Private helper method, containing common functionality for all 'add...Array' methods.
 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.
 com.drew.lang.Rational getRational(int tagType)
          Returns the specified tag's value as a Rational, if possible.
 com.drew.lang.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 setRational(int tagType, com.drew.lang.Rational rational)
          Sets a Rational value for the specified tag.
 void setRationalArray(int tagType, com.drew.lang.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tagMap

protected final java.util.HashMap _tagMap
Map of values hashed by type identifiers.


_descriptor

protected TagDescriptor _descriptor
The descriptor used to interperet tag values.


_definedTagList

protected final java.util.List _definedTagList
A convenient list holding tag values in the order in which they were stored. This is used for creation of an iterator, and for counting the number of defined tags.


_errorList

private java.util.List _errorList
Constructor Detail

Directory

public Directory()
Creates a new Directory.

Method Detail

getName

public abstract java.lang.String getName()
Provides the name of the directory, for display purposes. E.g. Exif


getTagNameMap

protected abstract java.util.HashMap getTagNameMap()
Provides the map of tag names, hashed by tag type identifier.


containsTag

public boolean containsTag(int tagType)
Indicates whether the specified tag type has been set.


getTagIterator

public java.util.Iterator getTagIterator()
Returns an Iterator of Tag instances that have been set in this Directory.


getTagCount

public int getTagCount()
Returns the number of tags set in this Directory.


setDescriptor

public void setDescriptor(TagDescriptor descriptor)
Sets the descriptor used to interperet tag values.


addError

public void addError(java.lang.String message)

hasErrors

public boolean hasErrors()

getErrors

public java.util.Iterator getErrors()

getErrorCount

public int getErrorCount()

setInt

public void setInt(int tagType,
                   int value)
Sets an int value for the specified tag.


setDouble

public void setDouble(int tagType,
                      double value)
Sets a double value for the specified tag.


setFloat

public void setFloat(int tagType,
                     float value)
Sets a float value for the specified tag.


setString

public void setString(int tagType,
                      java.lang.String value)
Sets an int value for the specified tag.


setBoolean

public void setBoolean(int tagType,
                       boolean value)
Sets an int value for the specified tag.


setLong

public void setLong(int tagType,
                    long value)
Sets a long value for the specified tag.


setDate

public void setDate(int tagType,
                    java.util.Date value)
Sets a java.util.Date value for the specified tag.


setRational

public void setRational(int tagType,
                        com.drew.lang.Rational rational)
Sets a Rational value for the specified tag.


setRationalArray

public void setRationalArray(int tagType,
                             com.drew.lang.Rational[] rationals)
Sets a Rational array for the specified tag.


setIntArray

public void setIntArray(int tagType,
                        int[] ints)
Sets an int array for the specified tag.


setByteArray

public void setByteArray(int tagType,
                         byte[] bytes)
Sets a byte array for the specified tag.


setStringArray

public void setStringArray(int tagType,
                           java.lang.String[] strings)
Sets a String array for the specified tag.


addObject

private void addObject(int tagType,
                       java.lang.Object value)
Private helper method, containing common functionality for all 'add' methods.


addObjectArray

private void addObjectArray(int tagType,
                            java.lang.Object array)
Private helper method, containing common functionality for all 'add...Array' methods.


getInt

public int getInt(int tagType)
           throws MetadataException
Returns the specified tag's value as an int, if possible.


getStringArray

public java.lang.String[] getStringArray(int tagType)
                                  throws MetadataException
Gets the specified tag's value as a String array, if possible. Only supported where the tag is set as String[], String, int[], byte[] or Rational[].


getIntArray

public int[] getIntArray(int tagType)
                  throws MetadataException
Gets the specified tag's value as an int array, if possible. Only supported where the tag is set as String, int[], byte[] or Rational[].


getByteArray

public byte[] getByteArray(int tagType)
                    throws MetadataException
Gets the specified tag's value as an byte array, if possible. Only supported where the tag is set as String, int[], byte[] or Rational[].


getDouble

public double getDouble(int tagType)
                 throws MetadataException
Returns the specified tag's value as a double, if possible.


getFloat

public float getFloat(int tagType)
               throws MetadataException
Returns the specified tag's value as a float, if possible.


getLong

public long getLong(int tagType)
             throws MetadataException
Returns the specified tag's value as a long, if possible.


getBoolean

public boolean getBoolean(int tagType)
                   throws MetadataException
Returns the specified tag's value as a boolean, if possible.


getDate

public java.util.Date getDate(int tagType)
                       throws MetadataException
Returns the specified tag's value as a java.util.Date, if possible.


getRational

public com.drew.lang.Rational getRational(int tagType)
                                   throws MetadataException
Returns the specified tag's value as a Rational, if possible.


getRationalArray

public com.drew.lang.Rational[] getRationalArray(int tagType)
                                          throws MetadataException

getString

public java.lang.String getString(int tagType)
Returns the specified tag's value as a String. In many cases, more presentable values will be obtained from getDescription(int).


getObject

public java.lang.Object getObject(int tagType)
Returns the object hashed for the particular tag type specified, if available.


getTagName

public java.lang.String getTagName(int tagType)
Returns the name of a specified tag as a String.


getDescription

public java.lang.String getDescription(int tagType)
                                throws MetadataException
Provides a description of a tag's value using the descriptor set by setDescriptor(Descriptor).