ExifTagInfo

This class stores information of an EXIF tag. For more information about defined EXIF tags, please read the Jeita EXIF 2.2 standard. Tags should be instantiated using .

open class ExifTagInfo

See also

Exify

Constructors

ExifTagInfo
Link copied to clipboard
open fun ExifTagInfo(tagId: Short, type: Short, componentCount: Int, ifd: Int, hasDefinedComponentCount: Boolean)

Functions

equals
Link copied to clipboard
open fun equals(obj: Any): Boolean
forceGetValueAsLong
Link copied to clipboard

Gets a long representation of the value.

open fun forceGetValueAsLong(defaultValue: Long): Long
forceGetValueAsString
Link copied to clipboard

Gets a string representation of the value.

open fun forceGetValueAsString(): String
getComponentCount
Link copied to clipboard

Gets the component count of this tag.

open fun getComponentCount(): Int
getDataSize
Link copied to clipboard

Gets the total data size in bytes of the value of this tag.

open fun getDataSize(): Int
getDataType
Link copied to clipboard

Gets the data type of this tag

open fun getDataType(): Short
getElementSize
Link copied to clipboard

Gets the element size of the given data type in bytes.

open fun getElementSize(type: Short): Int
getIfd
Link copied to clipboard

Returns the ID of the IFD this tag belongs to.

open fun getIfd(): Int
getTagId
Link copied to clipboard

Gets the TID of this tag.

open fun getTagId(): Short
getValue
Link copied to clipboard

Gets the tag's value or null if none exists.

open fun getValue(): Any
getValueAsByte
Link copied to clipboard

Gets the value as a byte. If there are more than 1 bytes in this value, gets the first byte. This method should be used for tags of type TYPE_UNDEFINED or TYPE_UNSIGNED_BYTE .

open fun getValueAsByte(defaultValue: Byte): Byte
getValueAsBytes
Link copied to clipboard

Gets the value as a byte array. This method should be used for tags of type TYPE_UNDEFINED or TYPE_UNSIGNED_BYTE .

open fun getValueAsBytes(): Array<Byte>
getValueAsInt
Link copied to clipboard

Gets the value as an int. If there are more than 1 ints in this value, gets the first one. This method should be used for tags of type TYPE_UNSIGNED_SHORT , TYPE_UNSIGNED_LONG .

open fun getValueAsInt(defaultValue: Int): Int
getValueAsInts
Link copied to clipboard

Gets the value as an array of ints. This method should be used for tags of type TYPE_UNSIGNED_SHORT , TYPE_UNSIGNED_LONG .

open fun getValueAsInts(): Array<Int>
getValueAsLong
Link copied to clipboard

Gets the value or null if none exists. If there are more than 1 longs in this value, gets the first one. This method should be used for tags of type TYPE_UNSIGNED_LONG .

open fun getValueAsLong(defaultValue: Long): Long
getValueAsLongs
Link copied to clipboard

Gets the value as an array of longs. This method should be used for tags of type TYPE_UNSIGNED_LONG .

open fun getValueAsLongs(): Array<Long>
getValueAsRational
Link copied to clipboard

Gets the value as a Rational. If there are more than 1 Rationals in this value, gets the first one. This method should be used for tags of type TYPE_RATIONAL or TYPE_UNSIGNED_RATIONAL .

open fun getValueAsRational(defaultValue: Rational): Rational
open fun getValueAsRational(defaultValue: Long): Rational
getValueAsRationals
Link copied to clipboard

Gets the value as an array of Rationals. This method should be used for tags of type TYPE_RATIONAL or TYPE_UNSIGNED_RATIONAL .

open fun getValueAsRationals(): Array<Rational>
getValueAsString
Link copied to clipboard

Gets the value as a String. This method should be used for tags of type TYPE_ASCII .

open fun getValueAsString(): String
open fun getValueAsString(defaultValue: String): String
hasValue
Link copied to clipboard

Returns true if this ExifTag contains value; otherwise, this tag will contain an offset value that is determined when the tag is written.

open fun hasValue(): Boolean
isValidIfd
Link copied to clipboard

Returns true if the given IFD is a valid IFD.

open fun isValidIfd(ifdId: Int): Boolean
isValidType
Link copied to clipboard

Returns true if a given type is a valid tag type.

open fun isValidType(type: Short): Boolean
setTimeValue
Link copied to clipboard

Sets a timestamp to this tag. The method converts the timestamp with the format of "yyyy:MM:dd kk:mm:ss" and calls setValue . This method will fail if the data type is not TYPE_ASCII or the component count of this tag is not 20 or undefined.

open fun setTimeValue(time: Long): Boolean
setValue
Link copied to clipboard

Sets a Rational value into this tag. This method should be used for tags of type TYPE_UNSIGNED_RATIONAL , or TYPE_RATIONAL . This method will fail if:

open fun setValue(value: Rational): Boolean

Sets Rational values into this tag. This method should be used for tags of type TYPE_UNSIGNED_RATIONAL , or TYPE_RATIONAL . This method will fail if:

  • The component type of this tag is not TYPE_UNSIGNED_RATIONAL or TYPE_RATIONAL .
  • The value overflows.
  • The value.length does NOT match the component count in the definition for this tag.

open fun setValue(value: Array<Rational>): Boolean

Sets byte value into this tag. This method should be used for tags of type TYPE_UNSIGNED_BYTE or TYPE_UNDEFINED . This method will fail if:

open fun setValue(value: Byte): Boolean

Equivalent to setValue(value, 0, value.length).

open fun setValue(value: Array<Byte>): Boolean

Sets integer value into this tag. This method should be used for tags of type TYPE_UNSIGNED_SHORT , or TYPE_LONG . This method will fail if:

open fun setValue(value: Int): Boolean

Sets integer values into this tag. This method should be used for tags of type TYPE_UNSIGNED_SHORT . This method will fail if:

open fun setValue(value: Array<Int>): Boolean

Sets the value for this tag using an appropriate setValue method for the given object. This method will fail if:

  • The corresponding setValue method for the class of the object passed in would fail.
  • There is no obvious way to cast the object passed in into an EXIF tag type.

open fun setValue(obj: Any): Boolean

Sets a string value into this tag. This method should be used for tags of type TYPE_ASCII . The string is converted to an ASCII string. Characters that cannot be converted are replaced with '?'. The length of the string must be equal to either (component count -1) or (component count). The final byte will be set to the string null terminator '\0', overwriting the last character in the string if the value.length is equal to the component count. This method will fail if:

  • The data type is not TYPE_ASCII or TYPE_UNDEFINED .
  • The length of the string is not equal to (component count -1) or (component count) in the definition for this tag.

open fun setValue(value: String): Boolean

Sets long values into this tag. This method should be used for tags of type TYPE_UNSIGNED_LONG . This method will fail if:

  • The component type of this tag is not TYPE_UNSIGNED_LONG .
  • The value overflows.
  • The component count in the definition for this tag is not 1.

open fun setValue(value: Long): Boolean

Sets long values into this tag. This method should be used for tags of type TYPE_UNSIGNED_LONG . This method will fail if:

  • The component type of this tag is not TYPE_UNSIGNED_LONG .
  • The value overflows.
  • The value.length does NOT match the component count in the definition for this tag.

open fun setValue(value: Array<Long>): Boolean

Sets byte values into this tag. This method should be used for tags of type TYPE_UNSIGNED_BYTE or TYPE_UNDEFINED . This method will fail if:

open fun setValue(value: Array<Byte>, offset: Int, length: Int): Boolean
toString
Link copied to clipboard
open fun toString(): String

Properties

SIZE_UNDEFINED
Link copied to clipboard
val SIZE_UNDEFINED: Int
TYPE_ASCII
Link copied to clipboard

The ASCII type in the EXIF standard. An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL.

val TYPE_ASCII: Short
TYPE_LONG
Link copied to clipboard

The SLONG type in the EXIF standard. A 32-bit (4-byte) signed integer (2's complement notation).

val TYPE_LONG: Short
TYPE_RATIONAL
Link copied to clipboard

The SRATIONAL type of EXIF standard. It consists of two SLONGs. The first one is the numerator and the second one is the denominator.

val TYPE_RATIONAL: Short
TYPE_UNDEFINED
Link copied to clipboard

The UNDEFINED type in the EXIF standard. An 8-bit byte that can take any value depending on the field definition.

val TYPE_UNDEFINED: Short
TYPE_UNSIGNED_BYTE
Link copied to clipboard

The BYTE type in the EXIF standard. An 8-bit unsigned integer.

val TYPE_UNSIGNED_BYTE: Short
TYPE_UNSIGNED_LONG
Link copied to clipboard

The LONG type in the EXIF standard. A 32-bit (4-byte) unsigned integer

val TYPE_UNSIGNED_LONG: Short
TYPE_UNSIGNED_RATIONAL
Link copied to clipboard

The RATIONAL type of EXIF standard. It consists of two LONGs. The first one is the numerator and the second one expresses the denominator.

val TYPE_UNSIGNED_RATIONAL: Short
TYPE_UNSIGNED_SHORT
Link copied to clipboard

The SHORT type in the EXIF standard. A 16-bit (2-byte) unsigned integer

val TYPE_UNSIGNED_SHORT: Short