java.lang.Object | |
↳ | javax.imageio.metadata.IIOMetadataFormatImpl |
![]() |
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
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | standardMetadataFormatName | A String constant containing the standard format
name, "javax_imageio_1.0" . |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a blank
IIOMetadataFormatImpl instance,
with a given root element name and child policy (other than
CHILD_POLICY_REPEAT ). | |||||||||||
Constructs a blank
IIOMetadataFormatImpl instance,
with a given root element name and a child policy of
CHILD_POLICY_REPEAT . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 . | |||||||||||
Returns one of the constants starting with
DATATYPE_ , indicating the format and
interpretation of the value of the given attribute within th
enamed element. | |||||||||||
Returns the default value of the named attribute, if it is not
explictly present within the named element, as a
String , or null if no default value
is available. | |||||||||||
Returns a
String containing a description of the
named attribute, or null . | |||||||||||
Returns an array of
String s containing the legal
enumerated values for the given attribute within the named
element. | |||||||||||
Returns the maximum number of list items that may be used to
define this attribute.
| |||||||||||
Returns the minimum number of list items that may be used to
define this attribute.
| |||||||||||
Returns the maximum legal value for the attribute.
| |||||||||||
Returns the minimum legal value for the attribute.
| |||||||||||
Returns an array of
String s listing the names of
the attributes that may be associated with the named element. | |||||||||||
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. | |||||||||||
Returns an array of
String s indicating the names
of the element which are allowed to be children of the named
element, in the order in which they should appear. | |||||||||||
Returns one of the constants starting with
CHILD_POLICY_ , indicating the legal pattern of
children for the named element. | |||||||||||
Returns a
String containing a description of the
named element, or null . | |||||||||||
Returns the maximum number of children of the named element
with child policy
CHILD_POLICY_REPEAT . | |||||||||||
Returns the minimum number of children of the named element
with child policy
CHILD_POLICY_REPEAT . | |||||||||||
Returns the maximum number of array elements that may be used
to define the
Object reference within the named
element. | |||||||||||
Returns the minimum number of array elements that may be used
to define the
Object reference within the named
element. | |||||||||||
Returns the
Class type of the Object
reference stored within the element. | |||||||||||
Returns an
Object s containing the default
value for the Object reference within
the named element. | |||||||||||
Returns an array of
Object s containing the legal
enumerated values for the Object reference within
the named element. | |||||||||||
Returns the maximum legal value for the
Object
reference within the named element. | |||||||||||
Returns the minimum legal value for the
Object
reference within the named element. | |||||||||||
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. | |||||||||||
Returns the name of the root element of the format.
| |||||||||||
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. | |||||||||||
Returns
true if the named attribute must be
present within the named element. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a new attribute to a previously defined element that will
be defined by a range of values.
| |||||||||||
Adds a new attribute to a previously defined element that may
be set to an arbitrary value.
| |||||||||||
Adds a new attribute to a previously defined element that will
be defined by a list of values.
| |||||||||||
Adds a new attribute to a previously defined element that will
be defined by a set of enumerated values.
| |||||||||||
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 . | |||||||||||
Adds an existing element to the list of legal children for a
given parent node type.
| |||||||||||
Adds a new element type to this metadata document format with a
child policy of
CHILD_POLICY_REPEAT . | |||||||||||
Adds a new element type to this metadata document format with a
child policy other than
CHILD_POLICY_REPEAT . | |||||||||||
Allows an
Object reference of a given class type
to be stored in nodes implementing the named element. | |||||||||||
Allows an
Object reference of a given class type
to be stored in nodes implementing the named element. | |||||||||||
Allows an
Object reference of a given class type
to be stored in nodes implementing the named element. | |||||||||||
Allows an
Object reference of a given class type
to be stored in nodes implementing the named element. | |||||||||||
Returns the currently set base name for locating
ResourceBundle s. | |||||||||||
Removes an attribute from a previously defined element.
| |||||||||||
Removes an element from the format.
| |||||||||||
Disallows an
Object reference from being stored in
nodes implementing the named element. | |||||||||||
Sets a new base name for locating
ResourceBundle s
containing descriptions of elements and attributes for this
format. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
A String
constant containing the standard format
name, "javax_imageio_1.0"
.
Constructs a blank IIOMetadataFormatImpl
instance,
with a given root element name and child policy (other than
CHILD_POLICY_REPEAT
). Additional elements, and
their attributes and Object
reference information
may be added using the various add
methods.
rootName | the name of the root element. |
---|---|
childPolicy | one of the CHILD_POLICY_* constants,
other than CHILD_POLICY_REPEAT . |
IllegalArgumentException | if rootName is
null . |
---|---|
IllegalArgumentException | if childPolicy is
not one of the predefined constants.
|
Constructs a blank IIOMetadataFormatImpl
instance,
with a given root element name and a child policy of
CHILD_POLICY_REPEAT
. Additional elements, and
their attributes and Object
reference information
may be added using the various add
methods.
rootName | the name of the root element. |
---|---|
minChildren | the minimum number of children of the node. |
maxChildren | the maximum number of children of the node. |
IllegalArgumentException | if rootName is
null . |
---|---|
IllegalArgumentException | if minChildren
is negative or larger than maxChildren .
|
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
.
For example, a metadata document format might contain an
element that describes the primary colors of the image, which
would not be allowed when writing a grayscale image.
elementName | the name of the element being queried. |
---|---|
imageType | an ImageTypeSpecifier indicating
the type of the image that will be associated with the
metadata. |
true
if the node is meaningful for images
of the given type.
Returns one of the constants starting with
DATATYPE_
, indicating the format and
interpretation of the value of the given attribute within th
enamed element. If getAttributeValueType
returns
VALUE_LIST
, then the legal value is a
whitespace-spearated list of values of the returned datatype.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
DATATYPE_*
constants.Returns the default value of the named attribute, if it is not
explictly present within the named element, as a
String
, or null
if no default value
is available.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
String
containing the default value, or
null
.Returns a String
containing a description of the
named attribute, or null
. The desciption will be
localized for the supplied Locale
if possible.
The default implementation will first locate a
ResourceBundle
using the current resource base
name set by setResourceBaseName
and the supplied
Locale
, using the fallback mechanism described in
the comments for ResourceBundle.getBundle
. If a
ResourceBundle
is found, the element name followed
by a "/" character followed by the attribute name
(elementName + "/" + attrName
) will be used as a
key to its getString
method, and the result
returned. If no ResourceBundle
is found, or no
such key is present, null
will be returned.
If locale
is null
, the current
default Locale
returned by Locale.getLocale
will be used.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute. |
locale | the Locale for which localization
will be attempted, or null . |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this format. |
---|---|
IllegalArgumentException | if attrName is
null or is not a legal attribute name for this
element. |
Returns an array of String
s containing the legal
enumerated values for the given attribute within the named
element. This method should only be called if
getAttributeValueType
returns
VALUE_ENUMERATION
.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
String
s.Returns the maximum number of list items that may be used to
define this attribute. A value of
Integer.MAX_VALUE
may be used to specify that
there is no upper bound. The attribute itself is defined as a
String
containing multiple whitespace-separated
items. This method should only be called if
getAttributeValueType
returns
VALUE_LIST
.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
Returns the minimum number of list items that may be used to
define this attribute. The attribute itself is defined as a
String
containing multiple whitespace-separated
items. This method should only be called if
getAttributeValueType
returns
VALUE_LIST
.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
Returns the maximum legal value for the attribute. Whether
this value is inclusive or exclusive may be determined by the
value of getAttributeValueType
. The value is
returned as a String
; its interpretation is
dependent on the value of getAttributeDataType
.
This method should only be called if
getAttributeValueType
returns
VALUE_RANGE_*
.
elementName | the name of the element being queried, as a
String . |
---|---|
attrName | the name of the attribute being queried. |
String
containing the largest legal
value for the attribute.Returns the minimum legal value for the attribute. Whether
this value is inclusive or exclusive may be determined by the
value of getAttributeValueType
. The value is
returned as a String
; its interpretation is
dependent on the value of getAttributeDataType
.
This method should only be called if
getAttributeValueType
returns
VALUE_RANGE_*
.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
String
containing the smallest legal
value for the attribute.Returns an array of String
s listing the names of
the attributes that may be associated with the named element.
elementName | the name of the element being queried. |
---|
String
s.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.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
VALUE_*
constants.Returns an array of String
s indicating the names
of the element which are allowed to be children of the named
element, in the order in which they should appear. If the
element cannot have children, null
is returned.
elementName | the name of the element being queried. |
---|
String
s, or null.Returns one of the constants starting with
CHILD_POLICY_
, indicating the legal pattern of
children for the named element.
elementName | the name of the element being queried. |
---|
CHILD_POLICY_*
constants.Returns a String
containing a description of the
named element, or null
. The desciption will be
localized for the supplied Locale
if possible.
The default implementation will first locate a
ResourceBundle
using the current resource base
name set by setResourceBaseName
and the supplied
Locale
, using the fallback mechanism described in
the comments for ResourceBundle.getBundle
. If a
ResourceBundle
is found, the element name will be
used as a key to its getString
method, and the
result returned. If no ResourceBundle
is found,
or no such key is present, null
will be returned.
If locale
is null
, the current
default Locale
returned by Locale.getLocale
will be used.
elementName | the name of the element. |
---|---|
locale | the Locale for which localization
will be attempted. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this format. |
---|
Returns the maximum number of children of the named element
with child policy CHILD_POLICY_REPEAT
. For
example, an element representing an entry in an 8-bit color
palette might be allowed to repeat up to 256 times. A value of
Integer.MAX_VALUE
may be used to specify that
there is no upper bound.
elementName | the name of the element being queried. |
---|
int
.Returns the minimum number of children of the named element
with child policy CHILD_POLICY_REPEAT
. For
example, an element representing color primary information
might be required to have at least 3 children, one for each
primay.
elementName | the name of the element being queried. |
---|
int
.Returns the maximum number of array elements that may be used
to define the Object
reference within the named
element. A value of Integer.MAX_VALUE
may be used
to specify that there is no upper bound. This method should
only be called if getObjectValueType
returns
VALUE_LIST
.
elementName | the name of the element being queried. |
---|
Object
reference.Returns the minimum number of array elements that may be used
to define the Object
reference within the named
element. This method should only be called if
getObjectValueType
returns
VALUE_LIST
.
elementName | the name of the element being queried. |
---|
Object
reference.Returns the Class
type of the Object
reference stored within the element. If this element may not
contain an Object
reference, an
IllegalArgumentException
will be thrown. If the
class type is an array, this field indicates the underlying
class type (e.g, for an array of int
s, this
method would return int.class
).
Object
references whose legal values are
defined as a range must implement the Comparable
interface.
elementName | the name of the element being queried. |
---|
Class
object.Returns an Object
s containing the default
value for the Object
reference within
the named element.
elementName | the name of the element being queried. |
---|
Object
.Returns an array of Object
s containing the legal
enumerated values for the Object
reference within
the named element. This method should only be called if
getObjectValueType
returns
VALUE_ENUMERATION
.
The Object
associated with a node that accepts
emuerated values must be equal to one of the values returned by
this method, as defined by the ==
operator (as
opposed to the Object.equals
method).
elementName | the name of the element being queried. |
---|
Object
s.Returns the maximum legal value for the Object
reference within the named element. Whether this value is
inclusive or exclusive may be determined by the value of
getObjectValueType
. This method should only be
called if getObjectValueType
returns one of the
constants starting with VALUE_RANGE
.
elementName | the name of the element being queried. |
---|
Returns the minimum legal value for the Object
reference within the named element. Whether this value is
inclusive or exclusive may be determined by the value of
getObjectValueType
. This method should only be
called if getObjectValueType
returns one of the
constants starting with VALUE_RANGE
.
elementName | the name of the element being queried. |
---|
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. If no object value can be
stored within the given element, the result of this method will
be VALUE_NONE
.
Object
references whose legal values are
defined as a range must implement the Comparable
interface.
elementName | the name of the element being queried. |
---|
VALUE_*
constants.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.
IIOMetadataFormat
instance.
Returns true
if the named attribute must be
present within the named element.
elementName | the name of the element being queried. |
---|---|
attrName | the name of the attribute being queried. |
true
if the attribut must be present.Adds a new attribute to a previously defined element that will be defined by a range of values.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being added. |
dataType | the data type (string format) of the attribute,
one of the DATATYPE_* constants. |
required | true if the attribute must be present. |
defaultValue | the default value for the attribute, or
null . |
minValue | the smallest (inclusive or exclusive depending
on the value of minInclusive ) legal value for the
attribute, as a String . |
maxValue | the largest (inclusive or exclusive depending
on the value of minInclusive ) legal value for the
attribute, as a String . |
minInclusive | true if minValue
is inclusive. |
maxInclusive | true if maxValue
is inclusive. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if attrName is
null . |
IllegalArgumentException | if dataType is
not one of the predefined constants.
|
Adds a new attribute to a previously defined element that may be set to an arbitrary value.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being added. |
dataType | the data type (string format) of the attribute,
one of the DATATYPE_* constants. |
required | true if the attribute must be present. |
defaultValue | the default value for the attribute, or
null . |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if attrName is
null . |
IllegalArgumentException | if dataType is
not one of the predefined constants.
|
Adds a new attribute to a previously defined element that will be defined by a list of values.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being added. |
dataType | the data type (string format) of the attribute,
one of the DATATYPE_* constants. |
required | true if the attribute must be present. |
listMinLength | the smallest legal number of list items. |
listMaxLength | the largest legal number of list items. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if attrName is
null . |
IllegalArgumentException | if dataType is
not one of the predefined constants. |
IllegalArgumentException | if
listMinLength is negative or larger than
listMaxLength .
|
Adds a new attribute to a previously defined element that will be defined by a set of enumerated values.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being added. |
dataType | the data type (string format) of the attribute,
one of the DATATYPE_* constants. |
required | true if the attribute must be present. |
defaultValue | the default value for the attribute, or
null . |
enumeratedValues | a List of
String s containing the legal values for the
attribute. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if attrName is
null . |
IllegalArgumentException | if dataType is
not one of the predefined constants. |
IllegalArgumentException | if
enumeratedValues is null . |
IllegalArgumentException | if
enumeratedValues does not contain at least one
entry. |
IllegalArgumentException | if
enumeratedValues contains an element that is not a
String or is null .
|
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
.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being added. |
hasDefaultValue | true if a default value
should be present. |
defaultValue | the default value for the attribute as a
boolean , ignored if hasDefaultValue
is false . |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if attrName is
null .
|
Adds an existing element to the list of legal children for a given parent node type.
elementName | the name of the element to be addded as a child. |
---|---|
parentName | the name of the element that will be the new parent of the element. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if parentName
is null , or is not a legal element name for this
format.
|
Adds a new element type to this metadata document format with a
child policy of CHILD_POLICY_REPEAT
.
elementName | the name of the new element. |
---|---|
parentName | the name of the element that will be the parent of the new element. |
minChildren | the minimum number of children of the node. |
maxChildren | the maximum number of children of the node. |
IllegalArgumentException | if parentName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if minChildren
is negative or larger than maxChildren .
|
Adds a new element type to this metadata document format with a
child policy other than CHILD_POLICY_REPEAT
.
elementName | the name of the new element. |
---|---|
parentName | the name of the element that will be the parent of the new element. |
childPolicy | one of the CHILD_POLICY_*
constants, other than CHILD_POLICY_REPEAT ,
indicating the child policy of the new element. |
IllegalArgumentException | if parentName
is null , or is not a legal element name for this
format. |
---|---|
IllegalArgumentException | if childPolicy
is not one of the predefined constants.
|
Allows an Object
reference of a given class type
to be stored in nodes implementing the named element. The
value of the Object
must an array of objects of
class type given by classType
, with at least
arrayMinLength
and at most
arrayMaxLength
elements.
If an Object
reference was previously allowed,
the previous settings are overwritten.
elementName | the name of the element. |
---|---|
classType | a Class variable indicating the
legal class type for the object value. |
arrayMinLength | the smallest legal length for the array. |
arrayMaxLength | the largest legal length for the array. |
IllegalArgumentException | if elementName is
not a legal element name for this format.
|
---|
Allows an Object
reference of a given class type
to be stored in nodes implementing the named element. The
value of the Object
is unconstrained other than by
its class type.
If an Object
reference was previously allowed,
the previous settings are overwritten.
elementName | the name of the element. |
---|---|
classType | a Class variable indicating the
legal class type for the object value. |
required | true if an object value must be present. |
defaultValue | the default value for the
Object reference, or null . |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this format.
|
---|
Allows an Object
reference of a given class type
to be stored in nodes implementing the named element. The
value of the Object
must be within the range given
by minValue
and maxValue
.
Furthermore, the class type must implement the
Comparable
interface.
If an Object
reference was previously allowed,
the previous settings are overwritten.
elementName | the name of the element. |
---|---|
classType | a Class variable indicating the
legal class type for the object value. |
defaultValue | the default value for the |
minValue | the smallest (inclusive or exclusive depending
on the value of minInclusive ) legal value for the
object value, as a String . |
maxValue | the largest (inclusive or exclusive depending
on the value of minInclusive ) legal value for the
object value, as a String . |
minInclusive | true if minValue
is inclusive. |
maxInclusive | true if maxValue
is inclusive. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this
format.
|
---|
Allows an Object
reference of a given class type
to be stored in nodes implementing the named element. The
value of the Object
must be one of the values
given by enumeratedValues
.
If an Object
reference was previously allowed,
the previous settings are overwritten.
elementName | the name of the element. |
---|---|
classType | a Class variable indicating the
legal class type for the object value. |
required | true if an object value must be present. |
defaultValue | the default value for the
Object reference, or null . |
enumeratedValues | a List of
Object s containing the legal values for the
object reference. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this format. |
---|---|
IllegalArgumentException | if
enumeratedValues is null . |
IllegalArgumentException | if
enumeratedValues does not contain at least one
entry. |
IllegalArgumentException | if
enumeratedValues contains an element that is not
an instance of the class type denoted by classType
or is null .
|
Returns the currently set base name for locating
ResourceBundle
s.
String
containing the base name.Removes an attribute from a previously defined element. If no attribute with the given name was present in the given element, nothing happens and no exception is thrown.
elementName | the name of the element. |
---|---|
attrName | the name of the attribute being removed. |
IllegalArgumentException | if elementName
is null , or is not a legal element name for this format.
|
---|
Removes an element from the format. If no element with the given name was present, nothing happens and no exception is thrown.
elementName | the name of the element to be removed. |
---|
Disallows an Object
reference from being stored in
nodes implementing the named element.
elementName | the name of the element. |
---|
IllegalArgumentException | if elementName is
not a legal element name for this format.
|
---|
Sets a new base name for locating ResourceBundle
s
containing descriptions of elements and attributes for this
format.
Prior to the first time this method is called, the base
name will be equal to this.getClass().getName() +
"Resources"
.
resourceBaseName | a String containg the new
base name. |
---|
IllegalArgumentException | if
resourceBaseName is null . |
---|