Class Directory
- Direct Known Subclasses:
AdobeJpegDirectory,AppleMakernoteDirectory,AppleRunTimeMakernoteDirectory,AviDirectory,BmpHeaderDirectory,CanonMakernoteDirectory,CasioType1MakernoteDirectory,CasioType2MakernoteDirectory,DuckyDirectory,EpsDirectory,ErrorDirectory,ExifDirectoryBase,FileSystemDirectory,FileTypeDirectory,FujifilmMakernoteDirectory,GifAnimationDirectory,GifCommentDirectory,GifControlDirectory,GifHeaderDirectory,GifImageDirectory,HeifDirectory,HuffmanTablesDirectory,IccDirectory,IcoDirectory,IptcDirectory,JfifDirectory,JfxxDirectory,JpegCommentDirectory,JpegDirectory,KodakMakernoteDirectory,KyoceraMakernoteDirectory,LeicaMakernoteDirectory,LeicaType5MakernoteDirectory,Mp3Directory,Mp4Directory,NikonPictureControl1Directory,NikonPictureControl2Directory,NikonType1MakernoteDirectory,NikonType2MakernoteDirectory,OlympusCameraSettingsMakernoteDirectory,OlympusEquipmentMakernoteDirectory,OlympusFocusInfoMakernoteDirectory,OlympusImageProcessingMakernoteDirectory,OlympusMakernoteDirectory,OlympusRawDevelopment2MakernoteDirectory,OlympusRawDevelopmentMakernoteDirectory,OlympusRawInfoMakernoteDirectory,PanasonicMakernoteDirectory,PanasonicRawDistortionDirectory,PanasonicRawIFD0Directory,PanasonicRawWbInfo2Directory,PanasonicRawWbInfoDirectory,PcxDirectory,PentaxMakernoteDirectory,PhotoshopDirectory,PngChromaticitiesDirectory,PngDirectory,PrintIMDirectory,PsdHeaderDirectory,QuickTimeDirectory,ReconyxHyperFire2MakernoteDirectory,ReconyxHyperFireMakernoteDirectory,ReconyxUltraFireMakernoteDirectory,RicohMakernoteDirectory,SamsungType2MakernoteDirectory,SanyoMakernoteDirectory,SigmaMakernoteDirectory,SonyEncodedDataDirectoryBase,SonyType1MakernoteDirectory,SonyType6MakernoteDirectory,WavDirectory,WebpDirectory,XmpDirectory
- Author:
- Drew Noakes https://drewnoakes.com
-
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters an error message with this directory.booleancontainsTag(int tagType) Indicates whether the specified tag type has been set.booleangetBoolean(int tagType) Returns the specified tag's value as a boolean, if possible.getBooleanObject(int tagType) Returns the specified tag's value as a boolean.byte[]getByteArray(int tagType) Gets the specified tag's value as an byte array, if possible.getDate(int tagType) Returns the specified tag's value as a java.util.Date.Returns the specified tag's value as a java.util.Date.Returns the specified tag's value as a java.util.Date.getDescription(int tagType) Provides a description of a tag's value using the descriptor set bysetDescriptor(Descriptor).doublegetDouble(int tagType) Returns the specified tag's value as a double, if possible.getDoubleObject(int tagType) Returns the specified tag's value as a Double.intReturns the count of error messages in this directory.Used to iterate over any error messages contained in this directory.floatgetFloat(int tagType) Returns the specified tag's value as a float, if possible.getFloatObject(int tagType) Returns the specified tag's value as a float.intgetInt(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.getInteger(int tagType) Returns the specified tag's value as an Integer, if possible.longgetLong(int tagType) Returns the specified tag's value as a long, if possible.getLongObject(int tagType) Returns the specified tag's value as a long.abstract StringgetName()Provides the name of the directory, for display purposes.getObject(int tagType) Returns the object hashed for the particular tag type specified, if available.getRational(int tagType) Returns the specified tag's value as a Rational.Rational[]getRationalArray(int tagType) Returns the specified tag's value as an array of Rational.getString(int tagType) Returns the specified tag's value as a String.String[]getStringArray(int tagType) Gets the specified tag's value as a String array, if possible.getStringValue(int tagType) getStringValueArray(int tagType) Gets the specified tag's value as a StringValue array, if possible.intReturns the number of tags set in this Directory.getTagName(int tagType) Returns the name of a specified tag as a String.getTags()Returns an Iterator of Tag instances that have been set in this Directory.booleanGets a value indicating whether this directory has any error messages.booleanhasTagName(int tagType) Gets whether the specified tag is known by the directory and has a name.booleanisEmpty()Gets a value indicating whether the directory is empty, meaning it contains no errors and no tag values.voidsetBoolean(int tagType, boolean value) Sets abooleanvalue for the specified tag.voidsetByteArray(int tagType, byte[] bytes) Sets abyte[](array) for the specified tag.voidSets ajava.util.Datevalue for the specified tag.voidsetDescriptor(TagDescriptor<?> descriptor) Sets the descriptor used to interpret tag values.voidsetDouble(int tagType, double value) Sets adoublevalue for the specified tag.voidsetDoubleArray(int tagType, double[] doubles) Sets adouble[](array) for the specified tag.voidsetFloat(int tagType, float value) Sets afloatvalue for the specified tag.voidsetFloatArray(int tagType, float[] floats) Sets afloat[](array) for the specified tag.voidsetInt(int tagType, int value) Sets anintvalue for the specified tag.voidsetIntArray(int tagType, int[] ints) Sets anint[](array) for the specified tag.voidsetLong(int tagType, long value) Sets alongvalue for the specified tag.voidSets aObjectfor the specified tag.voidsetObjectArray(int tagType, Object array) Sets an arrayObjectfor the specified tag.voidvoidsetRational(int tagType, Rational rational) Sets aRationalvalue for the specified tag.voidsetRationalArray(int tagType, Rational[] rationals) Sets aRational[](array) for the specified tag.voidSets aStringvalue for the specified tag.voidsetStringArray(int tagType, String[] strings) Sets aString[](array) for the specified tag.voidsetStringValue(int tagType, StringValue value) Sets aStringValuevalue for the specified tag.voidsetStringValueArray(int tagType, StringValue[] strings) Sets aStringValue[](array) for the specified tag.toString()
-
Method Details
-
getName
Provides the name of the directory, for display purposes. E.g.Exif- Returns:
- the name of the directory
-
isEmpty
public boolean isEmpty()Gets a value indicating whether the directory is empty, meaning it contains no errors and no tag values. -
containsTag
public boolean containsTag(int tagType) Indicates whether the specified tag type has been set.- Parameters:
tagType- the tag type to check for- Returns:
- true if a value exists for the specified tag type, false if not
-
getTags
Returns an Iterator of Tag instances that have been set in this Directory.- Returns:
- an Iterator of Tag instances
-
getTagCount
public int getTagCount()Returns the number of tags set in this Directory.- Returns:
- the number of tags set in this Directory
-
setDescriptor
Sets the descriptor used to interpret tag values.- Parameters:
descriptor- the descriptor used to interpret tag values
-
addError
Registers an error message with this directory.- Parameters:
message- an error message.
-
hasErrors
public boolean hasErrors()Gets a value indicating whether this directory has any error messages.- Returns:
- true if the directory contains errors, otherwise false
-
getErrors
Used to iterate over any error messages contained in this directory.- Returns:
- an iterable collection of error message strings.
-
getErrorCount
public int getErrorCount()Returns the count of error messages in this directory. -
getParent
-
setParent
-
setInt
public void setInt(int tagType, int value) Sets anintvalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as an int
-
setIntArray
public void setIntArray(int tagType, int[] ints) Sets anint[](array) for the specified tag.- Parameters:
tagType- the tag identifierints- the int array to store
-
setFloat
public void setFloat(int tagType, float value) Sets afloatvalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a float
-
setFloatArray
public void setFloatArray(int tagType, float[] floats) Sets afloat[](array) for the specified tag.- Parameters:
tagType- the tag identifierfloats- the float array to store
-
setDouble
public void setDouble(int tagType, double value) Sets adoublevalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a double
-
setDoubleArray
public void setDoubleArray(int tagType, double[] doubles) Sets adouble[](array) for the specified tag.- Parameters:
tagType- the tag identifierdoubles- the double array to store
-
setStringValue
Sets aStringValuevalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a StringValue
-
setString
Sets aStringvalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a String
-
setStringArray
Sets aString[](array) for the specified tag.- Parameters:
tagType- the tag identifierstrings- the String array to store
-
setStringValueArray
Sets aStringValue[](array) for the specified tag.- Parameters:
tagType- the tag identifierstrings- the StringValue array to store
-
setBoolean
public void setBoolean(int tagType, boolean value) Sets abooleanvalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a boolean
-
setLong
public void setLong(int tagType, long value) Sets alongvalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a long
-
setDate
Sets ajava.util.Datevalue for the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag as a java.util.Date
-
setRational
Sets aRationalvalue for the specified tag.- Parameters:
tagType- the tag's value as an intrational- rational number
-
setRationalArray
Sets aRational[](array) for the specified tag.- Parameters:
tagType- the tag identifierrationals- the Rational array to store
-
setByteArray
public void setByteArray(int tagType, byte[] bytes) Sets abyte[](array) for the specified tag.- Parameters:
tagType- the tag identifierbytes- the byte array to store
-
setObject
Sets aObjectfor the specified tag.- Parameters:
tagType- the tag's value as an intvalue- the value for the specified tag- Throws:
NullPointerException- if value isnull
-
setObjectArray
Sets an arrayObjectfor the specified tag.- Parameters:
tagType- the tag's value as an intarray- the array of values for the specified tag
-
getInt
Returns the specified tag's value as an int, if possible. Every attempt to represent the tag's value as an int is taken. Here is a list of the action taken depending upon the tag's original type:- int - Return unchanged.
- Number - Return an int value (real numbers are truncated).
- Rational - Truncate any fractional part and returns remaining int.
- String - Attempt to parse string as an int. If this fails, convert the char[] to an int (using shifts and OR).
- Rational[] - Return int value of first item in array.
- byte[] - Return int value of first item in array.
- int[] - Return int value of first item in array.
- Throws:
MetadataException- if no value exists for tagType or if it cannot be converted to an int.
-
getInteger
Returns the specified tag's value as an Integer, if possible. Every attempt to represent the tag's value as an Integer is taken. Here is a list of the action taken depending upon the tag's original type:- int - Return unchanged
- Number - Return an int value (real numbers are truncated)
- Rational - Truncate any fractional part and returns remaining int
- String - Attempt to parse string as an int. If this fails, convert the char[] to an int (using shifts and OR)
- Rational[] - Return int value of first item in array if length > 0
- byte[] - Return int value of first item in array if length > 0
- int[] - Return int value of first item in array if length > 0
nullis returned. -
getStringArray
Gets the specified tag's value as a String array, if possible. Only supported where the tag is set as StringValue[], String[], StringValue, String, int[], byte[] or Rational[].- Parameters:
tagType- the tag identifier- Returns:
- the tag's value as an array of Strings. If the value is unset or cannot be converted,
nullis returned.
-
getStringValueArray
Gets the specified tag's value as a StringValue array, if possible. Only succeeds if the tag is set as StringValue[], or StringValue.- Parameters:
tagType- the tag identifier- Returns:
- the tag's value as an array of StringValues. If the value is unset or cannot be converted,
nullis returned.
-
getIntArray
public int[] getIntArray(int tagType) Gets the specified tag's value as an int array, if possible. Only supported where the tag is set as String, Integer, int[], byte[] or Rational[].- Parameters:
tagType- the tag identifier- Returns:
- the tag's value as an int array
-
getByteArray
public byte[] getByteArray(int tagType) Gets the specified tag's value as an byte array, if possible. Only supported where the tag is set as String, Integer, int[], byte[] or Rational[].- Parameters:
tagType- the tag identifier- Returns:
- the tag's value as a byte array
-
getDouble
Returns the specified tag's value as a double, if possible.- Throws:
MetadataException
-
getDoubleObject
Returns the specified tag's value as a Double. If the tag is not set or cannot be converted,nullis returned. -
getFloat
Returns the specified tag's value as a float, if possible.- Throws:
MetadataException
-
getFloatObject
Returns the specified tag's value as a float. If the tag is not set or cannot be converted,nullis returned. -
getLong
Returns the specified tag's value as a long, if possible.- Throws:
MetadataException
-
getLongObject
Returns the specified tag's value as a long. If the tag is not set or cannot be converted,nullis returned. -
getBoolean
Returns the specified tag's value as a boolean, if possible.- Throws:
MetadataException
-
getBooleanObject
Returns the specified tag's value as a boolean. If the tag is not set or cannot be converted,nullis returned. -
getDate
Returns the specified tag's value as a java.util.Date. If the value is unset or cannot be converted,nullis returned.If the underlying value is a
String, then attempts will be made to parse the string as though it is in the GMTTimeZone. If theTimeZoneis known, call the overload that accepts one as an argument. -
getDate
Returns the specified tag's value as a java.util.Date. If the value is unset or cannot be converted,nullis returned.If the underlying value is a
String, then attempts will be made to parse the string as though it is in theTimeZonerepresented by thetimeZoneparameter (if it is non-null). Note that this parameter is only considered if the underlying value is a string and it has no time zone information, otherwise it has no effect. -
getDate
Returns the specified tag's value as a java.util.Date. If the value is unset or cannot be converted,nullis returned.If the underlying value is a
String, then attempts will be made to parse the string as though it is in theTimeZonerepresented by thetimeZoneparameter (if it is non-null). Note that this parameter is only considered if the underlying value is a string and it has no time zone information, otherwise it has no effect. In addition, thesubsecondparameter, which specifies the number of digits after the decimal point in the seconds, is set to the returned Date. This parameter is only considered if the underlying value is a string and is has no subsecond information, otherwise it has no effect.- Parameters:
tagType- the tag identifiersubsecond- the subsecond value for the DatetimeZone- the time zone to use- Returns:
- a Date representing the time value
-
getRational
Returns the specified tag's value as a Rational. If the value is unset or cannot be converted,nullis returned. -
getRationalArray
Returns the specified tag's value as an array of Rational. If the value is unset or cannot be converted,nullis returned. -
getString
Returns the specified tag's value as a String. This value is the 'raw' value. A more presentable decoding of this value may be obtained from the corresponding Descriptor.- Returns:
- the String representation of the tag's value, or
nullif the tag hasn't been defined.
-
getString
-
getStringValue
-
getObject
Returns the object hashed for the particular tag type specified, if available.- Parameters:
tagType- the tag type identifier- Returns:
- the tag's value as an Object if available, else
null
-
getTagName
Returns the name of a specified tag as a String.- Parameters:
tagType- the tag type identifier- Returns:
- the tag's name as a String
-
hasTagName
public boolean hasTagName(int tagType) Gets whether the specified tag is known by the directory and has a name.- Parameters:
tagType- the tag type identifier- Returns:
- whether this directory has a name for the specified tag
-
getDescription
Provides a description of a tag's value using the descriptor set bysetDescriptor(Descriptor).- Parameters:
tagType- the tag type identifier- Returns:
- the tag value's description as a String
-
toString
-