Top Description Inners Fields Constructors Methods
javax.imageio.metadata

public abstract Class IIOMetadataFormatImpl

extends Object
implements IIOMetadataFormat
Class Inheritance
All Implemented Interfaces
javax.imageio.metadata.IIOMetadataFormat
Known Direct Subclasses
com.sun.imageio.plugins.bmp.BMPMetadataFormat, com.sun.imageio.plugins.common.StandardMetadataFormat, com.sun.imageio.plugins.gif.GIFImageMetadataFormat, com.sun.imageio.plugins.gif.GIFStreamMetadataFormat, com.sun.imageio.plugins.jpeg.JPEGMetadataFormat, com.sun.imageio.plugins.png.PNGMetadataFormat, com.sun.imageio.plugins.wbmp.WBMPMetadataFormat
Imports
java.util.ArrayList, .HashMap, .List, .Locale, .Map, .MissingResourceException, .ResourceBundle, javax.imageio.ImageTypeSpecifier, com.sun.imageio.plugins.common.StandardMetadataFormat

A concrete class providing a reusable implementation of the IIOMetadataFormat interface. In addition, a static instance representing the standard, plug-in neutral javax_imageio_1.0 format is provided by the getStandardFormatInstance method.

In order to supply localized descriptions of elements and attributes, a ResourceBundle with a base name of this.getClass().getName() + "Resources" should be supplied via the usual mechanism used by ResourceBundle.getBundle. Briefly, the subclasser supplies one or more additional classes according to a naming convention (by default, the fully-qualified name of the subclass extending IIMetadataFormatImpl, plus the string "Resources", plus the country, language, and variant codes separated by underscores). At run time, calls to getElementDescription or getAttributeDescription will attempt to load such classes dynamically according to the supplied locale, and will use either the element name, or the element name followed by a '/' character followed by the attribute name as a key. This key will be supplied to the ResourceBundle's getString method, and the resulting localized description of the node or attribute is returned.

The subclass may supply a different base name for the resource bundles using the setResourceBaseName method.

A subclass may choose its own localization mechanism, if so desired, by overriding the supplied implementations of getElementDescription and getAttributeDescription.

See Also
ResourceBundle#getBundle(String, Locale)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private HashMap<String, IIOMetadataFormatImpl.Element>
private String
private String
private static IIOMetadataFormat
public static final String
standardMetadataFormatName

A String constant containing the standard format name, "javax_imageio_1.0".

Constructor Summary

AccessConstructor and Description
public
IIOMetadataFormatImpl(String
the name of the root element.
rootName
,
int
one of the CHILD_POLICY_* constants, other than CHILD_POLICY_REPEAT.
childPolicy
)

Constructs a blank IIOMetadataFormatImpl instance, with a given root element name and child policy (other than CHILD_POLICY_REPEAT).

public
IIOMetadataFormatImpl(String
the name of the root element.
rootName
,
int
the minimum number of children of the node.
minChildren
,
int
the maximum number of children of the node.
maxChildren
)

Constructs a blank IIOMetadataFormatImpl instance, with a given root element name and a child policy of CHILD_POLICY_REPEAT.

Method Summary

Modifier and TypeMethod and Description
protected void
addAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being added.
attrName
,
int
the data type (string format) of the attribute, one of the DATATYPE_* constants.
dataType
,
boolean
true if the attribute must be present.
required
,
String
the default value for the attribute, or null.
defaultValue
)

Adds a new attribute to a previously defined element that may be set to an arbitrary value.

protected void
addAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being added.
attrName
,
int
the data type (string format) of the attribute, one of the DATATYPE_* constants.
dataType
,
boolean
true if the attribute must be present.
required
,
String
the default value for the attribute, or null.
defaultValue
,
List<String>
a List of Strings containing the legal values for the attribute.
enumeratedValues
)

Adds a new attribute to a previously defined element that will be defined by a set of enumerated values.

protected void
addAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being added.
attrName
,
int
the data type (string format) of the attribute, one of the DATATYPE_* constants.
dataType
,
boolean
true if the attribute must be present.
required
,
String
the default value for the attribute, or null.
defaultValue
,
String
the smallest (inclusive or exclusive depending on the value of minInclusive) legal value for the attribute, as a String.
minValue
,
String
the largest (inclusive or exclusive depending on the value of minInclusive) legal value for the attribute, as a String.
maxValue
,
boolean
true if minValue is inclusive.
minInclusive
,
boolean
true if maxValue is inclusive.
maxInclusive
)

Adds a new attribute to a previously defined element that will be defined by a range of values.

protected void
addAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being added.
attrName
,
int
the data type (string format) of the attribute, one of the DATATYPE_* constants.
dataType
,
boolean
true if the attribute must be present.
required
,
int
the smallest legal number of list items.
listMinLength
,
int
the largest legal number of list items.
listMaxLength
)

Adds a new attribute to a previously defined element that will be defined by a list of values.

protected void
addBooleanAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being added.
attrName
,
boolean
true if a default value should be present.
hasDefaultValue
,
boolean
the default value for the attribute as a boolean, ignored if hasDefaultValue is false.
defaultValue
)

Adds a new attribute to a previously defined element that will be defined by the enumerated values TRUE and FALSE, with a datatype of DATATYPE_BOOLEAN.

protected void
addChildElement(String
the name of the element to be added as a child.
elementName
,
String
the name of the element that will be the new parent of the element.
parentName
)

Adds an existing element to the list of legal children for a given parent node type.

protected void
addElement(String
the name of the new element.
elementName
,
String
the name of the element that will be the parent of the new element.
parentName
,
int
one of the CHILD_POLICY_* constants, other than CHILD_POLICY_REPEAT, indicating the child policy of the new element.
childPolicy
)

Adds a new element type to this metadata document format with a child policy other than CHILD_POLICY_REPEAT.

protected void
addElement(String
the name of the new element.
elementName
,
String
the name of the element that will be the parent of the new element.
parentName
,
int
the minimum number of children of the node.
minChildren
,
int
the maximum number of children of the node.
maxChildren
)

Adds a new element type to this metadata document format with a child policy of CHILD_POLICY_REPEAT.

protected <
the type of the object.
T
>
void
addObjectValue(String
the name of the element.
elementName
,
Class<T>
a Class variable indicating the legal class type for the object value.
classType
,
boolean
true if an object value must be present.
required
,
T
the default value for the Object reference, or null.
defaultValue
)

Allows an Object reference of a given class type to be stored in nodes implementing the named element.

protected <
the type of the object.
T
>
void
addObjectValue(String
the name of the element.
elementName
,
Class<T>
a Class variable indicating the legal class type for the object value.
classType
,
boolean
true if an object value must be present.
required
,
T
the default value for the Object reference, or null.
defaultValue
,
List<? extends T>
a List of Objects containing the legal values for the object reference.
enumeratedValues
)

Allows an Object reference of a given class type to be stored in nodes implementing the named element.

protected <
the type of the object.
T extends Comparable<? super T>
>
void
addObjectValue(String
the name of the element.
elementName
,
Class<T>
a Class variable indicating the legal class type for the object value.
classType
,
T
the default value for the
defaultValue
,
Comparable<? super T>
the smallest (inclusive or exclusive depending on the value of minInclusive) legal value for the object value, as a String.
minValue
,
Comparable<? super T>
the largest (inclusive or exclusive depending on the value of minInclusive) legal value for the object value, as a String.
maxValue
,
boolean
true if minValue is inclusive.
minInclusive
,
boolean
true if maxValue is inclusive.
maxInclusive
)

Allows an Object reference of a given class type to be stored in nodes implementing the named element.

protected void
addObjectValue(String
the name of the element.
elementName
,
Class<?>
a Class variable indicating the legal class type for the object value.
classType
,
int
the smallest legal length for the array.
arrayMinLength
,
int
the largest legal length for the array.
arrayMaxLength
)

Allows an Object reference of a given class type to be stored in nodes implementing the named element.

public abstract boolean
canNodeAppear(String
the name of the element being queried.
elementName
,
ImageTypeSpecifier
an ImageTypeSpecifier indicating the type of the image that will be associated with the metadata.
imageType
)

Redeclares javax.imageio.metadata.IIOMetadataFormat.canNodeAppear.

Returns true if the element (and the subtree below it) is allowed to appear in a metadata document for an image of the given type, defined by an ImageTypeSpecifier.

private static synchronized void
private IIOMetadataFormatImpl.Attribute
getAttribute(String elementName, String attrName)

public int
getAttributeDataType(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeDataType.

Returns one of the constants starting with DATATYPE_, indicating the format and interpretation of the value of the given attribute within the named element.

public String
getAttributeDefaultValue(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeDefaultValue.

Returns the default value of the named attribute, if it is not explicitly present within the named element, as a String, or null if no default value is available.

public String

Returns:

the attribute description.
getAttributeDescription
(String
the name of the element.
elementName
,
String
the name of the attribute.
attrName
,
Locale
the Locale for which localization will be attempted, or null.
locale
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeDescription.

Returns a String containing a description of the named attribute, or null.

public String[]
getAttributeEnumerations(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeEnumerations.

Returns an array of Strings containing the legal enumerated values for the given attribute within the named element.

public int
getAttributeListMaxLength(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeListMaxLength.

Returns the maximum number of list items that may be used to define this attribute.

public int
getAttributeListMinLength(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeListMinLength.

Returns the minimum number of list items that may be used to define this attribute.

public String
getAttributeMaxValue(String
the name of the element being queried, as a String.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeMaxValue.

Returns the maximum legal value for the attribute.

public String
getAttributeMinValue(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeMinValue.

Returns the minimum legal value for the attribute.

public String[]
getAttributeNames(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeNames.

Returns an array of Strings listing the names of the attributes that may be associated with the named element.

public int
getAttributeValueType(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getAttributeValueType.

Returns one of the constants starting with VALUE_, indicating whether the values of the given attribute within the named element are arbitrary, constrained to lie within a specified range, constrained to be one of a set of enumerated values, or are a whitespace-separated list of arbitrary values.

public String[]
getChildNames(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getChildNames.

Returns an array of Strings indicating the names of the element which are allowed to be children of the named element, in the order in which they should appear.

public int
getChildPolicy(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getChildPolicy.

Returns one of the constants starting with CHILD_POLICY_, indicating the legal pattern of children for the named element.

private IIOMetadataFormatImpl.Element
getElement(String elementName, boolean
if true, throw an IllegalArgumentException if no such node exists; if false, just return null.
mustAppear
)

Utility method for locating an element.

private IIOMetadataFormatImpl.Element
getElement(String elementName)

public String

Returns:

the element description.
getElementDescription
(String
the name of the element.
elementName
,
Locale
the Locale for which localization will be attempted.
locale
)

Implements javax.imageio.metadata.IIOMetadataFormat.getElementDescription.

Returns a String containing a description of the named element, or null.

public int
getElementMaxChildren(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getElementMaxChildren.

Returns the maximum number of children of the named element with child policy CHILD_POLICY_REPEAT.

public int
getElementMinChildren(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getElementMinChildren.

Returns the minimum number of children of the named element with child policy CHILD_POLICY_REPEAT.

public int
getObjectArrayMaxLength(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectArrayMaxLength.

Returns the maximum number of array elements that may be used to define the Object reference within the named element.

public int
getObjectArrayMinLength(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectArrayMinLength.

Returns the minimum number of array elements that may be used to define the Object reference within the named element.

public Class<?>
getObjectClass(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectClass.

Returns the Class type of the Object reference stored within the element.

public Object
getObjectDefaultValue(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectDefaultValue.

Returns an Objects containing the default value for the Object reference within the named element.

public Object[]
getObjectEnumerations(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectEnumerations.

Returns an array of Objects containing the legal enumerated values for the Object reference within the named element.

public Comparable<?>
getObjectMaxValue(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectMaxValue.

Returns the maximum legal value for the Object reference within the named element.

public Comparable<?>
getObjectMinValue(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectMinValue.

Returns the minimum legal value for the Object reference within the named element.

private IIOMetadataFormatImpl.ObjectValue<?>
getObjectValue(String elementName)

public int
getObjectValueType(String
the name of the element being queried.
elementName
)

Implements javax.imageio.metadata.IIOMetadataFormat.getObjectValueType.

Returns one of the enumerated values starting with VALUE_, indicating the type of values (enumeration, range, or array) that are allowed for the Object reference.

private String
getResource(String key, Locale locale)

protected String

Returns:

a String containing the base name.
getResourceBaseName
()

Returns the currently set base name for locating ResourceBundles.

public String
getRootName()

Implements javax.imageio.metadata.IIOMetadataFormat.getRootName.

Returns the name of the root element of the format.

public static IIOMetadataFormat

Returns:

a predefined IIOMetadataFormat instance.
getStandardFormatInstance
()

Returns an IIOMetadataFormat object describing the standard, plug-in neutral javax.imageio_1.0 metadata document format described in the comment of the javax.imageio.metadata package.

public boolean
isAttributeRequired(String
the name of the element being queried.
elementName
,
String
the name of the attribute being queried.
attrName
)

Implements javax.imageio.metadata.IIOMetadataFormat.isAttributeRequired.

Returns true if the named attribute must be present within the named element.

protected void
removeAttribute(String
the name of the element.
elementName
,
String
the name of the attribute being removed.
attrName
)

Removes an attribute from a previously defined element.

protected void
removeElement(String
the name of the element to be removed.
elementName
)

Removes an element from the format.

protected void
removeObjectValue(String
the name of the element.
elementName
)

Disallows an Object reference from being stored in nodes implementing the named element.

protected void
setResourceBaseName(String
a String containing the new base name.
resourceBaseName
)

Sets a new base name for locating ResourceBundles containing descriptions of elements and attributes for this format.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait