diff options
Diffstat (limited to 'awt/javax/imageio/metadata')
-rw-r--r-- | awt/javax/imageio/metadata/IIOInvalidTreeException.java | 37 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOMetadata.java | 174 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOMetadataController.java | 17 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOMetadataFormat.java | 391 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOMetadataFormatImpl.java | 661 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOMetadataNode.java | 523 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/IIOStandardMetadataFormat.java | 85 | ||||
-rw-r--r-- | awt/javax/imageio/metadata/package.html | 8 |
8 files changed, 1241 insertions, 655 deletions
diff --git a/awt/javax/imageio/metadata/IIOInvalidTreeException.java b/awt/javax/imageio/metadata/IIOInvalidTreeException.java index 8690b2b..ba90657 100644 --- a/awt/javax/imageio/metadata/IIOInvalidTreeException.java +++ b/awt/javax/imageio/metadata/IIOInvalidTreeException.java @@ -21,21 +21,26 @@ import org.w3c.dom.Node; import javax.imageio.IIOException; /** - * The IIOInvalidTreeException provides notification about - * fails of IIOMetadataNodes tree parsing by IIOMetadata object. + * The IIOInvalidTreeException provides notification about fails of + * IIOMetadataNodes tree parsing by IIOMetadata object. + * + * @since Android 1.0 */ public class IIOInvalidTreeException extends IIOException { - - /** The offending node. */ + + /** + * The offending node. + */ protected Node offendingNode = null; /** - * Instantiates an IIOInvalidTreeException with the - * specified detailed message and specified offending - * Node. + * Instantiates an IIOInvalidTreeException with the specified detailed + * message and specified offending Node. * - * @param message the detailed message. - * @param offendingNode the offending node. + * @param message + * the detailed message. + * @param offendingNode + * the offending node. */ public IIOInvalidTreeException(String message, Node offendingNode) { super(message); @@ -43,13 +48,15 @@ public class IIOInvalidTreeException extends IIOException { } /** - * Instantiates a new IIOInvalidTreeException with the - * specified detailed message and specified offending - * Node. + * Instantiates a new IIOInvalidTreeException with the specified detailed + * message and specified offending Node. * - * @param message the detailed message. - * @param cause the cause of this exception. - * @param offendingNode the offending node + * @param message + * the detailed message. + * @param cause + * the cause of this exception. + * @param offendingNode + * the offending node. */ public IIOInvalidTreeException(String message, Throwable cause, Node offendingNode) { super(message, cause); diff --git a/awt/javax/imageio/metadata/IIOMetadata.java b/awt/javax/imageio/metadata/IIOMetadata.java index f2387cc..96cebf9 100644 --- a/awt/javax/imageio/metadata/IIOMetadata.java +++ b/awt/javax/imageio/metadata/IIOMetadata.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package javax.imageio.metadata; import java.util.ArrayList; @@ -22,73 +23,90 @@ import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils; import org.w3c.dom.Node; /** - * The Class IIOMetadata represents the metadata (bundled with an image) - * as a Dom-type tree. + * The class IIOMetadata represents the metadata (bundled with an image) as a + * Dom-type tree. + * + * @since Android 1.0 */ public abstract class IIOMetadata { - /** Whether the standard metadata format is supported. */ + /** + * Whether the standard metadata format is supported. + */ protected boolean standardFormatSupported; - - /** The native metadata format name. */ + + /** + * The native metadata format name. + */ protected String nativeMetadataFormatName; - - /** The native metadata format class name. */ + + /** + * The native metadata format class name. + */ protected String nativeMetadataFormatClassName; - - /** The extra metadata format names. */ + + /** + * The extra metadata format names. + */ protected String[] extraMetadataFormatNames; - - /** The extra metadata format class names. */ + + /** + * The extra metadata format class names. + */ protected String[] extraMetadataFormatClassNames; - - /** The default controller. */ + + /** + * The default controller. + */ protected IIOMetadataController defaultController; - - /** The controller. */ + + /** + * The controller. + */ protected IIOMetadataController controller; /** * Instantiates a new IIOMetadata with no data set. */ - protected IIOMetadata() {} + protected IIOMetadata() { + } /** * Instantiates a new IIOMetadata with the specified data parameters. * - * @param standardMetadataFormatSupported whether the standard metadata format is supported - * @param nativeMetadataFormatName the native metadata format name - * @param nativeMetadataFormatClassName the native metadata format class name - * @param extraMetadataFormatNames the extra metadata format names - * @param extraMetadataFormatClassNames the extra metadata format class names - */ - protected IIOMetadata(boolean standardMetadataFormatSupported, - String nativeMetadataFormatName, - String nativeMetadataFormatClassName, - String[] extraMetadataFormatNames, - String[] extraMetadataFormatClassNames) { + * @param standardMetadataFormatSupported + * whether the standard metadata format is supported. + * @param nativeMetadataFormatName + * the native metadata format name. + * @param nativeMetadataFormatClassName + * the native metadata format class name. + * @param extraMetadataFormatNames + * the extra metadata format names. + * @param extraMetadataFormatClassNames + * the extra metadata format class names. + */ + protected IIOMetadata(boolean standardMetadataFormatSupported, String nativeMetadataFormatName, + String nativeMetadataFormatClassName, String[] extraMetadataFormatNames, + String[] extraMetadataFormatClassNames) { standardFormatSupported = standardMetadataFormatSupported; this.nativeMetadataFormatName = nativeMetadataFormatName; this.nativeMetadataFormatClassName = nativeMetadataFormatClassName; if (extraMetadataFormatNames == null) { if (extraMetadataFormatClassNames != null) { throw new IllegalArgumentException( - "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!" - ); + "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!"); } } else { if (extraMetadataFormatClassNames == null) { throw new IllegalArgumentException( - "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!" - ); + "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!"); } if (extraMetadataFormatNames.length == 0) { throw new IllegalArgumentException("extraMetadataFormatNames.length == 0!"); } if (extraMetadataFormatClassNames.length != extraMetadataFormatNames.length) { throw new IllegalArgumentException( - "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!" - ); + "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!"); } this.extraMetadataFormatNames = extraMetadataFormatNames.clone(); this.extraMetadataFormatClassNames = extraMetadataFormatClassNames.clone(); @@ -98,30 +116,32 @@ public abstract class IIOMetadata { /** * Gets the metadata as tree-type document. * - * @param formatName the format name - * - * @return the node in tree format + * @param formatName + * the format name. + * @return the node in tree format. */ public abstract Node getAsTree(String formatName); - + /** * Checks if the metadata is read only. * * @return true, if the metadata is read only. */ public abstract boolean isReadOnly(); - + /** * Merges the specified tree with this metadata tree. * - * @param formatName the format of the specified tree - * @param root the root node of the metadata tree - * - * @throws IIOInvalidTreeException if the specified tree - * is incompatible with the this metadata tree. + * @param formatName + * the format of the specified tree. + * @param root + * the root node of the metadata tree. + * @throws IIOInvalidTreeException + * if the specified tree is incompatible with the this metadata + * tree. */ public abstract void mergeTree(String formatName, Node root) throws IIOInvalidTreeException; - + /** * Resets the controller. */ @@ -130,7 +150,7 @@ public abstract class IIOMetadata { /** * Gets the controller associated with this metadata document. * - * @return the controller + * @return the controller. */ public IIOMetadataController getController() { return controller; @@ -139,7 +159,7 @@ public abstract class IIOMetadata { /** * Checks whether this metadata has a controller. * - * @return true, if this metadata has a controller + * @return true, if this metadata has a controller. */ public boolean hasController() { return getController() != null; @@ -148,7 +168,7 @@ public abstract class IIOMetadata { /** * Activate the controller. * - * @return true, if successful + * @return true, if successful. */ public boolean activateController() { if (!hasController()) { @@ -160,7 +180,7 @@ public abstract class IIOMetadata { /** * Gets the default controller. * - * @return the default controller + * @return the default controller. */ public IIOMetadataController getDefaultController() { return defaultController; @@ -169,7 +189,7 @@ public abstract class IIOMetadata { /** * Gets the extra metadata format names. * - * @return the extra metadata format names + * @return the extra metadata format names. */ public String[] getExtraMetadataFormatNames() { return extraMetadataFormatNames == null ? null : extraMetadataFormatNames.clone(); @@ -178,23 +198,20 @@ public abstract class IIOMetadata { /** * Gets the metadata format. * - * @param formatName the format name - * - * @return the metadata format + * @param formatName + * the format name. + * @return the metadata format. */ public IIOMetadataFormat getMetadataFormat(String formatName) { - return IIOMetadataUtils.instantiateMetadataFormat( - formatName, - standardFormatSupported, - nativeMetadataFormatName, nativeMetadataFormatClassName, - extraMetadataFormatNames, extraMetadataFormatClassNames - ); + return IIOMetadataUtils.instantiateMetadataFormat(formatName, standardFormatSupported, + nativeMetadataFormatName, nativeMetadataFormatClassName, extraMetadataFormatNames, + extraMetadataFormatClassNames); } /** * Gets the native metadata format name. * - * @return the native metadata format name + * @return the native metadata format name. */ public String getNativeMetadataFormatName() { return nativeMetadataFormatName; @@ -203,7 +220,7 @@ public abstract class IIOMetadata { /** * Checks if the standard metadata format is supported. * - * @return true, if the standard metadata format is supported + * @return true, if the standard metadata format is supported. */ public boolean isStandardMetadataFormatSupported() { return standardFormatSupported; @@ -212,7 +229,7 @@ public abstract class IIOMetadata { /** * Gets the metadata format names. * - * @return the metadata format names + * @return the metadata format names. */ public String[] getMetadataFormatNames() { ArrayList<String> res = new ArrayList<String>(); @@ -239,7 +256,7 @@ public abstract class IIOMetadata { /** * Gets the standard chroma node. * - * @return the standard chroma node + * @return the standard chroma node. */ protected IIOMetadataNode getStandardChromaNode() { return null; @@ -248,7 +265,7 @@ public abstract class IIOMetadata { /** * Gets the standard compression node. * - * @return the standard compression node + * @return the standard compression node. */ protected IIOMetadataNode getStandardCompressionNode() { return null; @@ -257,7 +274,7 @@ public abstract class IIOMetadata { /** * Gets the standard data node. * - * @return the standard data node + * @return the standard data node. */ protected IIOMetadataNode getStandardDataNode() { return null; @@ -266,7 +283,7 @@ public abstract class IIOMetadata { /** * Gets the standard dimension node. * - * @return the standard dimension node + * @return the standard dimension node. */ protected IIOMetadataNode getStandardDimensionNode() { return null; @@ -275,7 +292,7 @@ public abstract class IIOMetadata { /** * Gets the standard document node. * - * @return the standard document node + * @return the standard document node. */ protected IIOMetadataNode getStandardDocumentNode() { return null; @@ -284,7 +301,7 @@ public abstract class IIOMetadata { /** * Gets the standard text node. * - * @return the standard text node + * @return the standard text node. */ protected IIOMetadataNode getStandardTextNode() { return null; @@ -293,7 +310,7 @@ public abstract class IIOMetadata { /** * Gets the standard tile node. * - * @return the standard tile node + * @return the standard tile node. */ protected IIOMetadataNode getStandardTileNode() { return null; @@ -302,7 +319,7 @@ public abstract class IIOMetadata { /** * Gets the standard transparency node. * - * @return the standard transparency node + * @return the standard transparency node. */ protected IIOMetadataNode getStandardTransparencyNode() { return null; @@ -311,7 +328,7 @@ public abstract class IIOMetadata { /** * Gets the metadata as a tree in standard format. * - * @return the metadata as a tree in standard format + * @return the metadata as a tree in standard format. */ protected final IIOMetadataNode getStandardTree() { // Create root node @@ -342,14 +359,15 @@ public abstract class IIOMetadata { if ((node = getStandardTransparencyNode()) != null) { root.appendChild(node); } - + return root; } /** * Sets the controller. * - * @param controller the new controller + * @param controller + * the new controller. */ public void setController(IIOMetadataController controller) { this.controller = controller; @@ -358,11 +376,13 @@ public abstract class IIOMetadata { /** * Sets the from tree. * - * @param formatName the name of the metatdata format of the from tree - * @param root the root node of the from tree - * - * @throws IIOInvalidTreeException if the tree or its format is not compatible with - * this metadata. + * @param formatName + * the name of the metatdata format of the from tree. + * @param root + * the root node of the from tree. + * @throws IIOInvalidTreeException + * if the tree or its format is not compatible with this + * metadata. */ public void setFromTree(String formatName, Node root) throws IIOInvalidTreeException { reset(); diff --git a/awt/javax/imageio/metadata/IIOMetadataController.java b/awt/javax/imageio/metadata/IIOMetadataController.java index dfd4e5c..1405948 100644 --- a/awt/javax/imageio/metadata/IIOMetadataController.java +++ b/awt/javax/imageio/metadata/IIOMetadataController.java @@ -18,6 +18,7 @@ * @author Sergey I. Salishev * @version $Revision: 1.2 $ */ + package javax.imageio.metadata; /* @@ -26,20 +27,20 @@ package javax.imageio.metadata; */ /** - * The IIOMetadataController interface provides a method for - * implementing objects to activate the controller without - * defining how the controller obtains values. + * The IIOMetadataController interface provides a method for implementing + * objects to activate the controller without defining how the controller + * obtains values. + * + * @since Android 1.0 */ public interface IIOMetadataController { /** * Activates a controller. * - * @param metadata the metadata to be modified. - * - * @return true if the IIOMetadata has been modified, - * false otherwise. + * @param metadata + * the metadata to be modified. + * @return true, if the IIOMetadata has been modified, false otherwise. */ public boolean activate(IIOMetadata metadata); } - diff --git a/awt/javax/imageio/metadata/IIOMetadataFormat.java b/awt/javax/imageio/metadata/IIOMetadataFormat.java index 9e246b4..0e7e697 100644 --- a/awt/javax/imageio/metadata/IIOMetadataFormat.java +++ b/awt/javax/imageio/metadata/IIOMetadataFormat.java @@ -21,327 +21,384 @@ import javax.imageio.ImageTypeSpecifier; import java.util.Locale; /** - * The Interface IIOMetadataFormat is implemented by classes that - * describe the rules and allowed elements for a metadata document - * tree. + * The Interface IIOMetadataFormat is implemented by classes that describe the + * rules and allowed elements for a metadata document tree. + * + * @since Android 1.0 */ public interface IIOMetadataFormat { - /** The CHILD_POLICY_EMPTY. */ + /** + * The CHILD_POLICY_EMPTY. + */ int CHILD_POLICY_EMPTY = 0; - - /** The CHILD_POLICY_ALL. */ + + /** + * The CHILD_POLICY_ALL. + */ int CHILD_POLICY_ALL = 1; - - /** The CHILD_POLICY_SOME. */ + + /** + * The CHILD_POLICY_SOME. + */ int CHILD_POLICY_SOME = 2; - - /** The CHILD_POLICY_CHOICE. */ + + /** + * The CHILD_POLICY_CHOICE. + */ int CHILD_POLICY_CHOICE = 3; - - /** The CHILD_POLICY_SEQUENCE. */ + + /** + * The CHILD_POLICY_SEQUENCE. + */ int CHILD_POLICY_SEQUENCE = 4; - - /** The CHILD_POLICY_REPEAT. */ + + /** + * The CHILD_POLICY_REPEAT. + */ int CHILD_POLICY_REPEAT = 5; - - /** The maximum value for the child policy. */ + + /** + * The maximum value for the child policy. + */ int CHILD_POLICY_MAX = CHILD_POLICY_REPEAT; - /** The DATATYPE_STRING. */ + /** + * The DATATYPE_STRING. + */ int DATATYPE_STRING = 0; - - /** The DATATYPE_BOOLEAN. */ + + /** + * The DATATYPE_BOOLEAN. + */ int DATATYPE_BOOLEAN = 1; - - /** The DATATYPE_INTEGER. */ + + /** + * The DATATYPE_INTEGER. + */ int DATATYPE_INTEGER = 2; - - /** The DATATYPE_FLOAT. */ + + /** + * The DATATYPE_FLOAT. + */ int DATATYPE_FLOAT = 3; - - /** The DATATYPE_DOUBLE. */ + + /** + * The DATATYPE_DOUBLE. + */ int DATATYPE_DOUBLE = 4; - /** The VALUE_NONE. */ + /** + * The VALUE_NONE. + */ int VALUE_NONE = 0; - - /** The VALUE_ARBITRARY. */ + + /** + * The VALUE_ARBITRARY. + */ int VALUE_ARBITRARY = 1; - - /** The VALUE_RANGE. */ + + /** + * The VALUE_RANGE. + */ int VALUE_RANGE = 2; - - /** The VALUE_RANGE_MIN_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE_MASK. + */ int VALUE_RANGE_MIN_INCLUSIVE_MASK = 4; - - /** The VALUE_RANGE_MAX_INCLUSIVE_MASK. */ + + /** + * The VALUE_RANGE_MAX_INCLUSIVE_MASK. + */ int VALUE_RANGE_MAX_INCLUSIVE_MASK = 8; - - /** The VALUE_ENUMERATION. */ + + /** + * The VALUE_ENUMERATION. + */ int VALUE_ENUMERATION = 16; - - /** The VALUE_LIST. */ + + /** + * The VALUE_LIST. + */ int VALUE_LIST = 32; - - /** The VALUE_RANGE_MIN_INCLUSIVE. */ + + /** + * The VALUE_RANGE_MIN_INCLUSIVE. + */ int VALUE_RANGE_MIN_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK; - - /** The VALUE_RANGE_MAX_INCLUSIVE. */ + + /** + * The VALUE_RANGE_MAX_INCLUSIVE. + */ int VALUE_RANGE_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MAX_INCLUSIVE_MASK; - - /** The VALUE_RANGE_MIN_MAX_INCLUSIVE. */ - int VALUE_RANGE_MIN_MAX_INCLUSIVE = - VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK | VALUE_RANGE_MAX_INCLUSIVE_MASK; /** - * Tells whether the specified element is allowed for the specified - * image type. - * - * @param elementName the element name - * @param imageType the image type - * - * @return true, if the specified element is allowed for the specified - * image type + * The VALUE_RANGE_MIN_MAX_INCLUSIVE. + */ + int VALUE_RANGE_MIN_MAX_INCLUSIVE = VALUE_RANGE | VALUE_RANGE_MIN_INCLUSIVE_MASK + | VALUE_RANGE_MAX_INCLUSIVE_MASK; + + /** + * Tells whether the specified element is allowed for the specified image + * type. + * + * @param elementName + * the element name. + * @param imageType + * the image type. + * @return true, if the specified element is allowed for the specified image + * type. */ boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType); /** * Gets data type of the specified attribute of the specified element. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute's data type + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute's data type. */ int getAttributeDataType(String elementName, String attrName); - + /** - * Gets the default value of the specified attribute of the specified element. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute's default value + * Gets the default value of the specified attribute of the specified + * element. + * + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute's default value. */ String getAttributeDefaultValue(String elementName, String attrName); - + /** * Gets the user-friendly description of the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * @param locale the locale giving the desired language for the - * description - * - * @return the attribute description + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @param locale + * the locale giving the desired language for the description. + * @return the attribute description. */ String getAttributeDescription(String elementName, String attrName, Locale locale); - + /** * Gets the attribute enumerations. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute enumerations + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute enumerations. */ String[] getAttributeEnumerations(String elementName, String attrName); - + /** * Gets the maximum length of the attribute list. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the maximum length of the attribute list + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the maximum length of the attribute list. */ int getAttributeListMaxLength(String elementName, String attrName); - + /** * Gets the minimum length of the attribute list. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the minimum length of the attribute list + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the minimum length of the attribute list. */ int getAttributeListMinLength(String elementName, String attrName); - + /** * Gets the maximum value allowed for the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the maximum value allowed for the attribute + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the maximum value allowed for the attribute. */ String getAttributeMaxValue(String elementName, String attrName); - + /** * Gets the minimum value allowed for the attribute. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the minimum value allowed for the attribute + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the minimum value allowed for the attribute. */ String getAttributeMinValue(String elementName, String attrName); - + /** * Gets the attribute names allowed for the specified element. * - * @param elementName the element name - * - * @return the attribute names + * @param elementName + * the element name. + * @return the attribute names. */ String[] getAttributeNames(String elementName); - + /** * Gets the attribute value type. * - * @param elementName the element name - * @param attrName the attribute name - * - * @return the attribute value type + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return the attribute value type. */ int getAttributeValueType(String elementName, String attrName); - + /** - * Checks whether the specified attribute is required - * for the specified element. - * - * @param elementName the element name - * @param attrName the attribute name - * - * @return true, if the specified attribute is required for the - * specified element + * Checks whether the specified attribute is required for the specified + * element. + * + * @param elementName + * the element name. + * @param attrName + * the attribute name. + * @return true, if the specified attribute is required for the specified + * element. */ boolean isAttributeRequired(String elementName, String attrName); /** * Gets the names of the possible child elements for the given element. * - * @param elementName the element name - * - * @return the child names + * @param elementName + * the element name. + * @return the child names. */ String[] getChildNames(String elementName); - + /** * Gets the constant describing the element's child policy. * - * @param elementName the element name - * - * @return the child policy + * @param elementName + * the element name. + * @return the child policy. */ int getChildPolicy(String elementName); /** * Gets the user-friendly description of the element. * - * @param elementName the element name - * @param locale the locale giving the desired language for the - * description - * - * @return the element description + * @param elementName + * the element name. + * @param locale + * the locale giving the desired language for the description. + * @return the element description. */ String getElementDescription(String elementName, Locale locale); - + /** * Gets the maximum number of children allowed for the element. * - * @param elementName the element name - * - * @return the maximum number of children allowed for the element + * @param elementName + * the element name. + * @return the maximum number of children allowed for the element. */ int getElementMaxChildren(String elementName); - + /** * Gets the minimum number of children allowed for the element. * - * @param elementName the element name - * - * @return the minimum number of children allowed for the element + * @param elementName + * the element name. + * @return the minimum number of children allowed for the element. */ int getElementMinChildren(String elementName); /** * Gets the maximum object array length allowed for the element. * - * @param elementName the element name - * - * @return the maximum object array length allowed for the element + * @param elementName + * the element name. + * @return the maximum object array length allowed for the element. */ int getObjectArrayMaxLength(String elementName); - + /** * Gets the minimum object array length allowed for the element. * - * @param elementName the element name - * - * @return the minimum object array length allowed for the element + * @param elementName + * the element name. + * @return the minimum object array length allowed for the element. */ int getObjectArrayMinLength(String elementName); - + /** * Gets the object class corresponding to the specified element. * - * @param elementName the element name - * - * @return the object class corresponding to the specified element + * @param elementName + * the element name. + * @return the object class corresponding to the specified element. */ Class<?> getObjectClass(String elementName); - + /** * Gets the object default value for the element. * - * @param elementName the element name - * - * @return the object default value for the element + * @param elementName + * the element name. + * @return the object default value for the element. */ Object getObjectDefaultValue(String elementName); - + /** * Gets the object enumerations. * - * @param elementName the element name - * - * @return the object enumerations + * @param elementName + * the element name. + * @return the object enumerations. */ Object[] getObjectEnumerations(String elementName); - + /** * Gets the maximum value allowed for the element's object. * - * @param elementName the element name - * - * @return the maximum value allowed for the element's object + * @param elementName + * the element name. + * @return the maximum value allowed for the element's object. */ Comparable<?> getObjectMaxValue(String elementName); - + /** * Gets the minimum value allowed for the element's object. * - * @param elementName the element name - * - * @return the minimum value allowed for the element's object + * @param elementName + * the element name. + * @return the minimum value allowed for the element's object. */ Comparable<?> getObjectMinValue(String elementName); - + /** * Gets the constant that indicates the type of the element's value. * - * @param elementName the element name - * - * @return the constant that indicates the type of the element's value + * @param elementName + * the element name. + * @return the constant that indicates the type of the element's value. */ int getObjectValueType(String elementName); /** * Gets the name of the root element. * - * @return the name of the root element + * @return the name of the root element. */ String getRootName(); } diff --git a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java index 438ae90..1a6e568 100644 --- a/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java +++ b/awt/javax/imageio/metadata/IIOMetadataFormatImpl.java @@ -23,45 +23,60 @@ import java.security.AccessController; import java.security.PrivilegedAction; /** - * The IIOMetadataFormatImpl class provides an implementation of the + * The IIOMetadataFormatImpl class provides an implementation of the * IIOMetadataFormat interface. + * + * @since Android 1.0 */ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { - - /** The Constant standardMetadataFormatName. */ - @SuppressWarnings({"ConstantDeclaredInAbstractClass"}) + + /** + * The Constant standardMetadataFormatName. + */ + @SuppressWarnings( { + "ConstantDeclaredInAbstractClass" + }) public static final String standardMetadataFormatName = "javax_imageio_1.0"; - /** The standard format. */ - @SuppressWarnings({"StaticNonFinalField"}) + /** + * The standard format. + */ + @SuppressWarnings( { + "StaticNonFinalField" + }) private static IIOMetadataFormatImpl standardFormat; - /** The root name. */ + /** + * The root name. + */ private String rootName; - - /** The element hash. */ + + /** + * The element hash. + */ private HashMap<String, Element> elementHash = new HashMap<String, Element>(); - /** The resource base name. */ + /** + * The resource base name. + */ private String resourceBaseName = getClass().getName() + "Resources"; /** - * Instantiates an IIOMetadataFormatImpl with the specified root - * name and child policy (not CHILD_POLICY_REPEAT). + * Instantiates an IIOMetadataFormatImpl with the specified root name and + * child policy (not CHILD_POLICY_REPEAT). * - * @param rootName the name of root element. - * @param childPolicy the child policy defined by one of the - * CHILD_POLICY_* constants (except CHILD_POLICY_REPEAT). + * @param rootName + * the name of root element. + * @param childPolicy + * the child policy defined by one of the CHILD_POLICY_* + * constants (except CHILD_POLICY_REPEAT). */ public IIOMetadataFormatImpl(String rootName, int childPolicy) { if (rootName == null) { throw new IllegalArgumentException("rootName is null"); } - if ( - childPolicy < CHILD_POLICY_EMPTY || - childPolicy > CHILD_POLICY_MAX || - childPolicy == CHILD_POLICY_REPEAT - ) { + if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX + || childPolicy == CHILD_POLICY_REPEAT) { throw new IllegalArgumentException("childPolicy is not one of the predefined constants"); } @@ -73,12 +88,15 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Instantiates an IIOMetadataFormatImpl with the specified root - * name and CHILD_POLICY_REPEAT child policy. + * Instantiates an IIOMetadataFormatImpl with the specified root name and + * CHILD_POLICY_REPEAT child policy. * - * @param rootName the name of root element. - * @param minChildren the minimum number of children. - * @param maxChildren the maximum number of children + * @param rootName + * the name of root element. + * @param minChildren + * the minimum number of children. + * @param maxChildren + * the maximum number of children */ public IIOMetadataFormatImpl(String rootName, int minChildren, int maxChildren) { if (rootName == null) { @@ -100,25 +118,31 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { elementHash.put(rootName, root); } - @SuppressWarnings({"AbstractMethodOverridesAbstractMethod"}) + @SuppressWarnings( { + "AbstractMethodOverridesAbstractMethod" + }) public abstract boolean canNodeAppear(String elementName, ImageTypeSpecifier imageType); /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param listMinLength the minimum legal number of list items. - * @param listMaxLength the the maximum legal number of list items. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, int listMinLength, int listMaxLength - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param listMinLength + * the minimum legal number of list items. + * @param listMaxLength + * the the maximum legal number of list items. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, int listMinLength, int listMaxLength) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -144,18 +168,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of the attribute. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of the attribute. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -177,20 +204,23 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of the attribute. - * @param enumeratedValues the legal values for the attribute as - * a list of strings. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, List<String> enumeratedValues - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of the attribute. + * @param enumeratedValues + * the legal values for the attribute as a list of strings. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue, List<String> enumeratedValues) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -226,26 +256,30 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Adds a new attribute to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param dataType the data type of the new attribute. - * @param required the flag which indicates whether this attribute - * must be present. - * @param defaultValue the default value of attribute. - * @param minValue the minimum legal value of an attribute. - * @param maxValue the maximum legal value of an attribute. - * @param minInclusive the flag which indicates - * whether the minValue is inclusive. - * @param maxInclusive the flag which indicates - * whether the maxValue is inclusive. - */ - protected void addAttribute( - String elementName, String attrName, int dataType, - boolean required, String defaultValue, - String minValue, String maxValue, - boolean minInclusive, boolean maxInclusive - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param dataType + * the data type of the new attribute. + * @param required + * the flag which indicates whether this attribute must be + * present. + * @param defaultValue + * the default value of attribute. + * @param minValue + * the minimum legal value of an attribute. + * @param maxValue + * the maximum legal value of an attribute. + * @param minInclusive + * the flag which indicates whether the minValue is inclusive. + * @param maxInclusive + * the flag which indicates whether the maxValue is inclusive. + */ + protected void addAttribute(String elementName, String attrName, int dataType, + boolean required, String defaultValue, String minValue, String maxValue, + boolean minInclusive, boolean maxInclusive) { if (attrName == null) { throw new IllegalArgumentException("attrName == null!"); } @@ -272,20 +306,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new attribute with boolean data type to an existing - * element. + * Adds a new attribute with boolean data type to an existing element. * - * @param elementName the name of the element to which the new attribute - * will be added. - * @param attrName the attribute name. - * @param hasDefaultValue the flag which indicates whether this attribute - * must have a default value. - * @param defaultValue the default value. - */ - protected void addBooleanAttribute( - String elementName, String attrName, - boolean hasDefaultValue, boolean defaultValue - ) { + * @param elementName + * the name of the element to which the new attribute will be + * added. + * @param attrName + * the attribute name. + * @param hasDefaultValue + * the flag which indicates whether this attribute must have a + * default value. + * @param defaultValue + * the default value. + */ + protected void addBooleanAttribute(String elementName, String attrName, + boolean hasDefaultValue, boolean defaultValue) { String defaultVal = hasDefaultValue ? (defaultValue ? "TRUE" : "FALSE") : null; ArrayList<String> values = new ArrayList<String>(2); values.add("TRUE"); @@ -295,11 +330,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an existing element to the list of child elements - * of the specified parent element. + * Adds an existing element to the list of child elements of the specified + * parent element. * - * @param elementName the name of the element to be added. - * @param parentName the parent element name. + * @param elementName + * the name of the element to be added. + * @param parentName + * the parent element name. */ protected void addChildElement(String elementName, String parentName) { Element parent = findElement(parentName); @@ -308,23 +345,23 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new element type to this IIOMetadataFormat with - * a child policy (if policy is not CHILD_POLICY_REPEAT). + * Adds a new element type to this IIOMetadataFormat with a child policy (if + * policy is not CHILD_POLICY_REPEAT). * - * @param elementName the name of the element to be added. - * @param parentName the parent element name. - * @param childPolicy one of the CHILD_POLICY_* constants defined - * by IIOMetadataFormat. + * @param elementName + * the name of the element to be added. + * @param parentName + * the parent element name. + * @param childPolicy + * one of the CHILD_POLICY_* constants defined by + * IIOMetadataFormat. */ protected void addElement(String elementName, String parentName, int childPolicy) { - if ( - childPolicy < CHILD_POLICY_EMPTY || - childPolicy > CHILD_POLICY_MAX || - childPolicy == CHILD_POLICY_REPEAT - ) { + if (childPolicy < CHILD_POLICY_EMPTY || childPolicy > CHILD_POLICY_MAX + || childPolicy == CHILD_POLICY_REPEAT) { throw new IllegalArgumentException("childPolicy is not one of the predefined constants"); } - + Element parent = findElement(parentName); Element element = new Element(); element.name = elementName; @@ -334,19 +371,21 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds a new element type to this IIOMetadataFormat with - * CHILD_POLICY_REPEAT and the specified minimum and maximum - * number of child elements. + * Adds a new element type to this IIOMetadataFormat with + * CHILD_POLICY_REPEAT and the specified minimum and maximum number of child + * elements. * - * @param elementName the element name to be added. - * @param parentName the parent element name. - * @param minChildren the minimum number of child elements. - * @param maxChildren the maximum number of child elements. - */ - protected void addElement( - String elementName, String parentName, - int minChildren, int maxChildren - ) { + * @param elementName + * the element name to be added. + * @param parentName + * the parent element name. + * @param minChildren + * the minimum number of child elements. + * @param maxChildren + * the maximum number of child elements. + */ + protected void addElement(String elementName, String parentName, int minChildren, + int maxChildren) { if (minChildren < 0) { throw new IllegalArgumentException("minChildren < 0!"); } @@ -365,19 +404,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as element's value. + * Adds an Object reference with the specified class type to be stored as + * element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object's value. - * @param arrayMinLength the minimum legal length for the array. - * @param arrayMaxLength the maximum legal length for the array. - */ - protected void addObjectValue( - String elementName, Class<?> classType, - int arrayMinLength, int arrayMaxLength - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object's value. + * @param arrayMinLength + * the minimum legal length for the array. + * @param arrayMaxLength + * the maximum legal length for the array. + */ + protected void addObjectValue(String elementName, Class<?> classType, int arrayMinLength, + int arrayMaxLength) { Element element = findElement(elementName); ObjectValue objVal = new ObjectValue(); @@ -390,20 +430,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as an element's value. + * Adds an Object reference with the specified class type to be stored as an + * element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object's value. - * @param required a flag indicated that this object value - * must be present. - * @param defaultValue the default value, or null. - */ - protected <T> void addObjectValue( - String elementName, Class<T> classType, - boolean required, T defaultValue - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object's value. + * @param required + * a flag indicated that this object value must be present. + * @param defaultValue + * the default value, or null. + */ + protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required, + T defaultValue) { // note: reqired is an unused parameter Element element = findElement(elementName); @@ -416,22 +456,22 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as the element's value. + * Adds an Object reference with the specified class type to be stored as + * the element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object value. - * @param required a flag indicated that this object value - * must be present. - * @param defaultValue the default value, or null. - * @param enumeratedValues the list of legal values for the object. - */ - protected <T> void addObjectValue( - String elementName, Class<T> classType, - boolean required, T defaultValue, - List<? extends T> enumeratedValues - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object value. + * @param required + * a flag indicated that this object value must be present. + * @param defaultValue + * the default value, or null. + * @param enumeratedValues + * the list of legal values for the object. + */ + protected <T> void addObjectValue(String elementName, Class<T> classType, boolean required, + T defaultValue, List<? extends T> enumeratedValues) { // note: reqired is an unused parameter if (enumeratedValues == null || enumeratedValues.isEmpty()) { throw new IllegalArgumentException("enumeratedValues is empty or null"); @@ -444,7 +484,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } } } catch (ClassCastException e) { - throw new IllegalArgumentException("enumeratedValues contains a value not of class classType!"); + throw new IllegalArgumentException( + "enumeratedValues contains a value not of class classType!"); } Element element = findElement(elementName); @@ -459,25 +500,27 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Adds an Object reference with the specified class type to be - * stored as the element's value. + * Adds an Object reference with the specified class type to be stored as + * the element's value. * - * @param elementName the element name. - * @param classType the class indicates the legal types for - * the object value. - * @param defaultValue the default value, or null. - * @param minValue the minimum legal value for the object value. - * @param maxValue the maximum legal value for the object value. - * @param minInclusive the flag which indicates - * whether the minValue is inclusive. - * @param maxInclusive the flag which indicates - * whether the maxValue is inclusive. - */ - protected <T extends Object & Comparable<? super T>> void addObjectValue( - String elementName, Class<T> classType, - T defaultValue, Comparable<? super T> minValue, Comparable<? super T> maxValue, - boolean minInclusive, boolean maxInclusive - ) { + * @param elementName + * the element name. + * @param classType + * the class indicates the legal types for the object value. + * @param defaultValue + * the default value, or null. + * @param minValue + * the minimum legal value for the object value. + * @param maxValue + * the maximum legal value for the object value. + * @param minInclusive + * the flag which indicates whether the minValue is inclusive. + * @param maxInclusive + * the flag which indicates whether the maxValue is inclusive. + */ + protected <T extends Object & Comparable<? super T>> void addObjectValue(String elementName, + Class<T> classType, T defaultValue, Comparable<? super T> minValue, + Comparable<? super T> maxValue, boolean minInclusive, boolean maxInclusive) { Element element = findElement(elementName); ObjectValue<T> objVal = new ObjectValue<T>(); @@ -540,7 +583,7 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { if ((attr.valueType & VALUE_RANGE) == 0) { throw new IllegalArgumentException("Attribute is not a range!"); } - return attr.maxValue; + return attr.maxValue; } public String getAttributeMinValue(String elementName, String attrName) { @@ -558,12 +601,13 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { public int getAttributeValueType(String elementName, String attrName) { Attlist attr = findAttribute(elementName, attrName); - return attr.valueType; + return attr.valueType; } public String[] getChildNames(String elementName) { Element element = findElement(elementName); - if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have children + if (element.childPolicy == CHILD_POLICY_EMPTY) { // Element cannot have + // children return null; } return element.children.toArray(new String[element.children.size()]); @@ -689,10 +733,12 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { } /** - * Removes the specified attribute from the specified element. - * - * @param elementName the specified element name. - * @param attrName the specified attribute name. + * Removes the specified attribute from the specified element. + * + * @param elementName + * the specified element name. + * @param attrName + * the specified attribute name. */ protected void removeAttribute(String elementName, String attrName) { Element element = findElement(elementName); @@ -702,7 +748,8 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Removes the specified element from this format. * - * @param elementName the specified element name. + * @param elementName + * the specified element name. */ protected void removeElement(String elementName) { Element element; @@ -717,18 +764,20 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Removes the object value from the specified element. * - * @param elementName the element name. + * @param elementName + * the element name. */ protected void removeObjectValue(String elementName) { Element element = findElement(elementName); element.objectValue = null; } - + /** - * Sets a new base name for ResourceBundles containing - * descriptions of elements and attributes for this format. + * Sets a new base name for ResourceBundles containing descriptions of + * elements and attributes for this format. * - * @param resourceBaseName the new resource base name. + * @param resourceBaseName + * the new resource base name. */ protected void setResourceBaseName(String resourceBaseName) { if (resourceBaseName == null) { @@ -740,117 +789,181 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * The Class Element. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class Element { - - /** The name. */ + + /** + * The name. + */ String name; - /** The children. */ + /** + * The children. + */ ArrayList<String> children = new ArrayList<String>(); - - /** The attributes. */ + + /** + * The attributes. + */ HashMap<String, Attlist> attributes = new HashMap<String, Attlist>(); - /** The min children. */ + /** + * The min children. + */ int minChildren; - - /** The max children. */ + + /** + * The max children. + */ int maxChildren; - - /** The child policy. */ + + /** + * The child policy. + */ int childPolicy; - /** The object value. */ + /** + * The object value. + */ ObjectValue objectValue; } /** * The Class Attlist. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class Attlist { - - /** The name. */ + + /** + * The name. + */ String name; - /** The data type. */ + /** + * The data type. + */ int dataType; - - /** The required. */ + + /** + * The required. + */ boolean required; - - /** The list min length. */ + + /** + * The list min length. + */ int listMinLength; - - /** The list max length. */ + + /** + * The list max length. + */ int listMaxLength; - - /** The default value. */ + + /** + * The default value. + */ String defaultValue; - - /** The enumerated values. */ + + /** + * The enumerated values. + */ List<String> enumeratedValues; - - /** The min value. */ + + /** + * The min value. + */ String minValue; - - /** The max value. */ + + /** + * The max value. + */ String maxValue; - - /** The min inclusive. */ + + /** + * The min inclusive. + */ boolean minInclusive; - - /** The max inclusive. */ + + /** + * The max inclusive. + */ boolean maxInclusive; - /** The value type. */ + /** + * The value type. + */ int valueType; } /** * The Class ObjectValue. */ - @SuppressWarnings({"ClassWithoutConstructor"}) + @SuppressWarnings( { + "ClassWithoutConstructor" + }) private class ObjectValue<T> { - - /** The class type. */ + + /** + * The class type. + */ Class<T> classType; - - /** The array min length. */ + + /** + * The array min length. + */ int arrayMinLength; - - /** The array max length. */ + + /** + * The array max length. + */ int arrayMaxLength; - - /** The default value. */ + + /** + * The default value. + */ T defaultValue; - - /** The enumerated values. */ + + /** + * The enumerated values. + */ List<? extends T> enumeratedValues; - - /** The min value. */ + + /** + * The min value. + */ Comparable<? super T> minValue; - - /** The max value. */ + + /** + * The max value. + */ Comparable<? super T> maxValue; - - /** The min inclusive. */ + + /** + * The min inclusive. + */ boolean minInclusive; - - /** The max inclusive. */ + + /** + * The max inclusive. + */ boolean maxInclusive; - /** The value type. */ + /** + * The value type. + */ int valueType; } /** * Find element. * - * @param name the name - * - * @return the element + * @param name + * the name. + * @return the element. */ private Element findElement(String name) { Element element; @@ -864,16 +977,18 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Find attribute. * - * @param elementName the element name - * @param attributeName the attribute name - * - * @return the attlist + * @param elementName + * the element name. + * @param attributeName + * the attribute name. + * @return the attlist. */ private Attlist findAttribute(String elementName, String attributeName) { Element element = findElement(elementName); Attlist attribute; if ((attribute = element.attributes.get(attributeName)) == null) { - throw new IllegalArgumentException("attribute name is null or no such attribute: " + attributeName); + throw new IllegalArgumentException("attribute name is null or no such attribute: " + + attributeName); } return attribute; @@ -882,9 +997,9 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Find object value. * - * @param elementName the element name - * - * @return the object value + * @param elementName + * the element name. + * @return the object value. */ private ObjectValue findObjectValue(String elementName) { Element element = findElement(elementName); @@ -898,23 +1013,25 @@ public abstract class IIOMetadataFormatImpl implements IIOMetadataFormat { /** * Gets the resource string. * - * @param key the key - * @param locale the locale - * - * @return the resource string + * @param key + * the key. + * @param locale + * the locale. + * @return the resource string. */ private String getResourceString(String key, Locale locale) { if (locale == null) { locale = Locale.getDefault(); } - // Get the context class loader and try to locate the bundle with it first - ClassLoader contextClassloader = AccessController.doPrivileged( - new PrivilegedAction<ClassLoader>() { + // Get the context class loader and try to locate the bundle with it + // first + ClassLoader contextClassloader = AccessController + .doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } - }); + }); // Now try to get the resource bundle ResourceBundle rb; diff --git a/awt/javax/imageio/metadata/IIOMetadataNode.java b/awt/javax/imageio/metadata/IIOMetadataNode.java index d5ab7a5..adc6d67 100644 --- a/awt/javax/imageio/metadata/IIOMetadataNode.java +++ b/awt/javax/imageio/metadata/IIOMetadataNode.java @@ -27,47 +27,71 @@ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; + //???AWT //import org.w3c.dom.TypeInfo; //import org.w3c.dom.UserDataHandler; /** - * The Class IIOMetadataNode represents a node of the - * (DOM-style) metadata tree. + * The Class IIOMetadataNode represents a node of the (DOM-style) metadata tree. + * + * @since Android 1.0 */ public class IIOMetadataNode implements Element, NodeList { - /** The node name. */ + /** + * The node name. + */ private String nodeName; - - /** The node value. */ + + /** + * The node value. + */ private String nodeValue; - - /** The attributes. */ + + /** + * The attributes. + */ private IIOMetadataNodeList attrs = new IIOMetadataNodeList(new ArrayList<IIOMetadataNode>()); - /** The parent node. */ + /** + * The parent node. + */ private IIOMetadataNode parent; - - /** The first child node. */ + + /** + * The first child node. + */ private IIOMetadataNode firstChild; - - /** The last child node. */ + + /** + * The last child node. + */ private IIOMetadataNode lastChild; - - /** The previous sibling. */ + + /** + * The previous sibling. + */ private IIOMetadataNode previousSibling; - - /** The next sibling. */ + + /** + * The next sibling. + */ private IIOMetadataNode nextSibling; - /** The number of children. */ + /** + * The number of children. + */ private int nChildren; - /** The user object associated with this node. */ + /** + * The user object associated with this node. + */ private Object userObject; - /** The text content of this node. */ + /** + * The text content of this node. + */ private String textContent; /** @@ -79,18 +103,20 @@ public class IIOMetadataNode implements Element, NodeList { /** * Instantiates a new empty node with the specified name. * - * @param nodeName the node name + * @param nodeName + * the node name. */ public IIOMetadataNode(String nodeName) { this.nodeName = nodeName; } /** - * Instantiates a new IIOMetadataNode with the specified - * name and value. + * Instantiates a new IIOMetadataNode with the specified name and value. * - * @param nodeName the node name - * @param nodeValue the node value + * @param nodeName + * the node name. + * @param nodeValue + * the node value. */ private IIOMetadataNode(String nodeName, String nodeValue) { this.nodeName = nodeName; @@ -102,12 +128,12 @@ public class IIOMetadataNode implements Element, NodeList { } public String getAttribute(String name) { - Attr attrNode = (Attr) attrs.getNamedItem(name); + Attr attrNode = (Attr)attrs.getNamedItem(name); return (attrNode == null) ? "" : attrNode.getValue(); } public void setAttribute(String name, String value) throws DOMException { - Attr attr = (Attr) attrs.getNamedItem(name); + Attr attr = (Attr)attrs.getNamedItem(name); if (attr != null) { attr.setValue(value); } else { @@ -116,7 +142,7 @@ public class IIOMetadataNode implements Element, NodeList { } public void removeAttribute(String name) throws DOMException { - IIOMetadataAttr attr = (IIOMetadataAttr) attrs.getNamedItem(name); + IIOMetadataAttr attr = (IIOMetadataAttr)attrs.getNamedItem(name); if (attr != null) { attr.setOwnerElement(null); attrs.list.remove(attr); @@ -124,17 +150,19 @@ public class IIOMetadataNode implements Element, NodeList { } public Attr getAttributeNode(String name) { - return (Attr) attrs.getNamedItem(name); + return (Attr)attrs.getNamedItem(name); } public Attr setAttributeNode(Attr newAttr) throws DOMException { // Check if this attribute is already in use. Element owner = newAttr.getOwnerElement(); if (owner != null) { - if (owner == this) { // Replacing an attribute node by itself has no effect + if (owner == this) { // Replacing an attribute node by itself has no + // effect return null; } else { - throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, "Attribute is already in use"); + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR, + "Attribute is already in use"); } } @@ -146,7 +174,7 @@ public class IIOMetadataNode implements Element, NodeList { IIOMetadataAttr iioAttr; if (newAttr instanceof IIOMetadataAttr) { - iioAttr = (IIOMetadataAttr) newAttr; + iioAttr = (IIOMetadataAttr)newAttr; iioAttr.setOwnerElement(this); } else { iioAttr = new IIOMetadataAttr(name, newAttr.getValue(), this); @@ -206,7 +234,8 @@ public class IIOMetadataNode implements Element, NodeList { return getAttribute(localName); } - public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { + public void setAttributeNS(String namespaceURI, String qualifiedName, String value) + throws DOMException { setAttribute(qualifiedName, value); } @@ -222,7 +251,8 @@ public class IIOMetadataNode implements Element, NodeList { return setAttributeNode(newAttr); } - public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException { + public NodeList getElementsByTagNameNS(String namespaceURI, String localName) + throws DOMException { return getElementsByTagName(localName); } @@ -234,20 +264,105 @@ public class IIOMetadataNode implements Element, NodeList { return hasAttribute(localName); } - //???AWT + // ???AWT /* - public TypeInfo getSchemaTypeInfo() { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); - }*/ + * public TypeInfo getSchemaTypeInfo() { throw new + * DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + */ + /** + * <i>Description copied from interface: org.w3c.dom.Element (DOM Level + * 3)</i> + * <p> + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. To specify an attribute by local name and + * namespace URI, use the setIdAttributeNS method. + * </p> + * + * @param name + * the name of the attribute. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + * <p> + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * <br> + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + * </p> + */ public void setIdAttribute(String name, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } - public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException { + /** + * <i>Description copied from interface: org.w3c.dom.Element (DOM Level + * 3)</i> + * <p> + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. + * </p> + * + * @param namespaceURI + * the namespace URI of the attribute. + * @param localName + * the local name of the attribute. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + * <p> + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * <br> + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + * </p> + */ + public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) + throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Element (DOM Level + * 3)</i> + * <p> + * If the parameter isId is true, this method declares the specified + * attribute to be a user-determined ID attribute . This affects the value + * of Attr.isId and the behavior of Document.getElementById, but does not + * change any schema that may be in use, in particular this does not affect + * the Attr.schemaTypeInfo of the specified Attr node. Use the value false + * for the parameter isId to undeclare an attribute for being a + * user-determined ID attribute. + * </p> + * + * @param idAttr + * the attribute node. + * @param isId + * the flag which determines whether this attribute is of type + * ID. + * @throws DOMException + * if a DOM error occurred while setting the attribute type. + * <p> + * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. + * <br> + * NOT_FOUND_ERR: Raised if the specified node is not an + * attribute of this element. + * </p> + */ public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -305,8 +420,8 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("newChild == null!"); } - IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; - IIOMetadataNode refIIOChild = (IIOMetadataNode) refChild; + IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild; + IIOMetadataNode refIIOChild = (IIOMetadataNode)refChild; newIIOChild.parent = this; @@ -349,8 +464,8 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("newChild == null!"); } - IIOMetadataNode newIIOChild = (IIOMetadataNode) newChild; - IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; + IIOMetadataNode newIIOChild = (IIOMetadataNode)newChild; + IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild; IIOMetadataNode next = oldIIOChild.nextSibling; IIOMetadataNode previous = oldIIOChild.previousSibling; @@ -389,7 +504,7 @@ public class IIOMetadataNode implements Element, NodeList { throw new IllegalArgumentException("oldChild == null!"); } - IIOMetadataNode oldIIOChild = (IIOMetadataNode) oldChild; + IIOMetadataNode oldIIOChild = (IIOMetadataNode)oldChild; // Fix next and previous IIOMetadataNode previous = oldIIOChild.previousSibling; @@ -439,7 +554,8 @@ public class IIOMetadataNode implements Element, NodeList { } } - return cloned; //To change body of implemented methods use File | Settings | File Templates. + return cloned; // To change body of implemented methods use File | + // Settings | File Templates. } public void normalize() { @@ -470,52 +586,314 @@ public class IIOMetadataNode implements Element, NodeList { return attrs.list.size() > 0; } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * The absolute base URI of this node or null if the implementation wasn't + * able to obtain an absolute URI. This value is computed as described in. + * However, when the Document supports the feature "HTML" [DOM Level 2 + * HTML], the base URI is computed using first the value of the href + * attribute of the HTML BASE element if any, and the value of the + * documentURI attribute from the Document interface otherwise. + * </p> + * + * @return the string representation of the absolute base URI. + */ public String getBaseURI() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Compares the reference node, i.e. the node on which this method is being + * called, with a node, i.e. the one passed as a parameter, with regard to + * their position in the document and according to the document order. + * </p> + * + * @param other + * the node to compare against the reference node. + * @return Returns how the node is positioned relatively to the reference + * node. + * @throws DOMException + * NOT_SUPPORTED_ERR: when the compared nodes are from different + * DOM implementations that do not coordinate to return + * consistent implementation-specific results. + */ public short compareDocumentPosition(Node other) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * This attribute returns the text content of this node and its descendants. + * When it is defined to be null, setting it has no effect. On setting, any + * possible children this node may have are removed and, if it the new + * string is not empty or null, replaced by a single Text node containing + * the string this attribute is set to. On getting, no serialization is + * performed, the returned string does not contain any markup. No whitespace + * normalization is performed and the returned string does not contain the + * white spaces in element content (see the attribute + * Text.isElementContentWhitespace). Similarly, on setting, no parsing is + * performed either, the input string is taken as pure textual content. The + * string returned is made of the text content of this node depending on its + * type, as defined below: + * <table> + * <tr> + * <td><strong>Node type</strong></td> + * <td><strong>Content</strong></td> + * </tr> + * <tr> + * <td>ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, + * DOCUMENT_FRAGMENT_NODE</td> + * <td>concatenation of the textContent attribute value of every child node, + * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the + * empty string if the node has no children.</td> + * </tr> + * <tr> + * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, + * PROCESSING_INSTRUCTION_NODE</td> + * <td>nodeValue</td> + * </tr> + * <tr> + * <td>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td> + * <td>null</td> + * </tr> + * </table> + * </p> + * + * @return the text content depending on the type of this node. + * @throws DOMException + * DOMSTRING_SIZE_ERR: Raised when it would return more + * characters than fit in a DOMString variable on the + * implementation platform. + */ public String getTextContent() throws DOMException { return textContent; } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * This attribute returns the text content of this node and its descendants. + * When it is defined to be null, setting it has no effect. On setting, any + * possible children this node may have are removed and, if it the new + * string is not empty or null, replaced by a single Text node containing + * the string this attribute is set to. On getting, no serialization is + * performed, the returned string does not contain any markup. No whitespace + * normalization is performed and the returned string does not contain the + * white spaces in element content (see the attribute + * Text.isElementContentWhitespace). Similarly, on setting, no parsing is + * performed either, the input string is taken as pure textual content. The + * string returned is made of the text content of this node depending on its + * type, as defined below: + * <table> + * <tr> + * <td><strong>Node type</strong></td> + * <td><strong>Content</strong></td> + * </tr> + * <tr> + * <td>ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, + * DOCUMENT_FRAGMENT_NODE</td> + * <td>concatenation of the textContent attribute value of every child node, + * excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the + * empty string if the node has no children.</td> + * </tr> + * <tr> + * <td>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, + * PROCESSING_INSTRUCTION_NODE</td> + * <td>nodeValue</td> + * </tr> + * <tr> + * <td>DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td> + * <td>null</td> + * </tr> + * </table> + * </p> + * + * @param textContent + * the text content for this node. + * @throws DOMException + * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is + * readonly. + */ public void setTextContent(String textContent) throws DOMException { this.textContent = textContent; } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Returns whether this node is the same node as the given one. This method + * provides a way to determine whether two Node references returned by the + * implementation reference the same object. When two Node references are + * references to the same object, even if through a proxy, the references + * may be used completely interchangeably, such that all attributes have the + * same values and calling the same DOM method on either reference always + * has exactly the same effect. + * </p> + * + * @param other + * the node to test against. + * @return true, if the nodes are the same, false otherwise. + */ public boolean isSameNode(Node other) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Look up the prefix associated to the given namespace URI, starting from + * this node. The default namespace declarations are ignored by this method. + * See for details on the algorithm used by this method. + * </p> + * + * @param namespaceURI + * the namespace URI to look for. + * @return the associated namespace prefix if found or null if none is + * found. If more than one prefix are associated to the namespace + * prefix, the returned namespace prefix is implementation + * dependent. + */ public String lookupPrefix(String namespaceURI) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * This method checks if the specified namespaceURI is the default namespace + * or not. + * </p> + * + * @param namespaceURI + * the namespace URI to look for. + * @return true, if the specified namespaceURI is the default namespace, + * false otherwise. + */ public boolean isDefaultNamespace(String namespaceURI) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Look up the namespace URI associated to the given prefix, starting from + * this node. See for details on the algorithm used by this method. + * </p> + * + * @param prefix + * the prefix to look for. If this parameter is null, the method + * will return the default namespace URI if any. + * @return the associated namespace URI or null if none is found. + */ public String lookupNamespaceURI(String prefix) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Tests whether two nodes are equal. This method tests for equality of + * nodes, not sameness (i.e., whether the two nodes are references to the + * same object) which can be tested with Node.isSameNode(). All nodes that + * are the same will also be equal, though the reverse may not be true. Two + * nodes are equal if and only if the following conditions are satisfied: + * <p> + * <li>The two nodes are of the same type.</li> + * <li>The following string attributes are equal: nodeName, localName, + * namespaceURI, prefix, nodeValue . This is: they are both null, or they + * have the same length and are character for character identical.</li> + * <li>The attributes NamedNodeMaps are equal. This is: they are both null, + * or they have the same length and for each node that exists in one map + * there is a node that exists in the other map and is equal, although not + * necessarily at the same index.</li> + * <li>The childNodes NodeLists are equal. This is: they are both null, or + * they have the same length and contain equal nodes at the same index. Note + * that normalization can affect equality; to avoid this, nodes should be + * normalized before being compared.</li> + * </p> + * For two DocumentType nodes to be equal, the following conditions must + * also be satisfied: + * <p> + * <li>The following string attributes are equal: publicId, systemId, + * internalSubset.</li> + * <li>The entities NamedNodeMaps are equal.</li> + * <li>The notations NamedNodeMaps are equal.</li> + * </p> + * On the other hand, the following do not affect equality: the + * ownerDocument, baseURI, and parentNode attributes, the specified + * attribute for Attr nodes, the schemaTypeInfo attribute for Attr and + * Element nodes, the Text.isElementContentWhitespace attribute for Text + * nodes, as well as any user data or event listeners registered on the + * nodes. </p> + * <p> + * Note: As a general rule, anything not mentioned in the description above + * is not significant in consideration of equality checking. Note that + * future versions of this specification may take into account more + * attributes and implementations conform to this specification are expected + * to be updated accordingly. + * </p> + * + * @param arg + * the node to compare equality with. + * @return true, if the nodes are equal, false otherwise. + */ public boolean isEqualNode(Node arg) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * This method returns a specialized object which implements the specialized + * APIs of the specified feature and version, as specified in. The + * specialized object may also be obtained by using binding-specific casting + * methods but is not necessarily expected to, as discussed in. This method + * also allow the implementation to provide specialized objects which do not + * support the Node interface. + * </p> + * + * @param feature + * the name of the feature requested. Note that any plus sign "+" + * prepended to the name of the feature will be ignored since it + * is not significant in the context of this method. + * @param version + * this is the version number of the feature to test. + * @return the object which implements the specialized APIs of the specified + * feature and version, if any, or null if there is no object which + * implements interfaces associated with that feature. If the + * DOMObject returned by this method implements the Node interface, + * it must delegate to the primary core Node and not return results + * inconsistent with the primary core Node such as attributes, + * childNodes, etc. + */ public Object getFeature(String feature, String version) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } - //???AWT + // ???AWT /* - public Object setUserData(String key, Object data, UserDataHandler handler) { - throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); - }*/ + * public Object setUserData(String key, Object data, UserDataHandler + * handler) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, + * "Method not supported"); } + */ + /** + * <i>Description copied from interface: org.w3c.dom.Node (DOM Level 3)</i> + * <p> + * Retrieves the object associated to a key on a this node. The object must + * first have been set to this node by calling setUserData with the same + * key. + * </p> + * + * @param key + * the key the object is associated to. + * @return the DOMUserData associated to the given key on this node, or null + * if there was none. + */ public Object getUserData(String key) { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -540,7 +918,7 @@ public class IIOMetadataNode implements Element, NodeList { /** * Gets the user object associated with this node. * - * @return the user object associated with this node + * @return the user object associated with this node. */ public Object getUserObject() { return userObject; @@ -549,7 +927,8 @@ public class IIOMetadataNode implements Element, NodeList { /** * Sets the user object associated with this node. * - * @param userObject the new user object associated with this node + * @param userObject + * the new user object associated with this node. */ public void setUserObject(Object userObject) { this.userObject = userObject; @@ -559,16 +938,21 @@ public class IIOMetadataNode implements Element, NodeList { * The Class IIOMetadataAttr. */ private class IIOMetadataAttr extends IIOMetadataNode implements Attr { - - /** The owner element. */ + + /** + * The owner element. + */ private Element ownerElement; /** * Instantiates a new iIO metadata attr. * - * @param name the name - * @param value the value - * @param owner the owner + * @param name + * the name. + * @param value + * the value. + * @param owner + * the owner. */ public IIOMetadataAttr(String name, String value, Element owner) { super(name, value); @@ -598,12 +982,16 @@ public class IIOMetadataNode implements Element, NodeList { /** * Sets the owner element. * - * @param ownerElement the new owner element + * @param ownerElement + * the new owner element. */ public void setOwnerElement(Element ownerElement) { this.ownerElement = ownerElement; } + /** + * @return + */ public boolean isId() { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "Method not supported"); } @@ -618,14 +1006,17 @@ public class IIOMetadataNode implements Element, NodeList { * The Class IIOMetadataNodeList. */ private class IIOMetadataNodeList implements NodeList, NamedNodeMap { - - /** The list. */ + + /** + * The list. + */ private List<IIOMetadataNode> list; /** * Instantiates a new iIO metadata node list. * - * @param list the list + * @param list + * the list. */ IIOMetadataNodeList(List<IIOMetadataNode> list) { this.list = list; @@ -644,7 +1035,7 @@ public class IIOMetadataNode implements Element, NodeList { } public Node getNamedItem(String name) { - for(IIOMetadataNode node:list) { + for (IIOMetadataNode node : list) { if (name.equals(node.getNodeName())) { return node; } @@ -653,11 +1044,13 @@ public class IIOMetadataNode implements Element, NodeList { } public Node setNamedItem(Node arg) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node removeNamedItem(String name) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException { @@ -665,11 +1058,13 @@ public class IIOMetadataNode implements Element, NodeList { } public Node setNamedItemNS(Node arg) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException { - throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "This NamedNodeMap is read-only!"); + throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + "This NamedNodeMap is read-only!"); } } } diff --git a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java index 94d2125..706cb2f 100644 --- a/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java +++ b/awt/javax/imageio/metadata/IIOStandardMetadataFormat.java @@ -15,18 +15,19 @@ * limitations under the License. */ - package javax.imageio.metadata; import javax.imageio.ImageTypeSpecifier; import java.util.ArrayList; /** - * The Class IIOStandardMetadataFormat describes the rules of the - * standard metadata format. + * The class IIOStandardMetadataFormat describes the rules of the standard + * metadata format. + * + * @since Android 1.0 */ -class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { - +class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { + /** * Instantiates a new IIOStandardMetadataFormat. */ @@ -41,7 +42,7 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { } /** - * Builds the dtd that describes the standard metadata format. + * Builds the DTD that describes the standard metadata format. */ private void buildDTD() { // CHROMA @@ -80,7 +81,10 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("ColorSpaceType", "name", DATATYPE_STRING, true, null, values); addElement("NumChannels", "Chroma", CHILD_POLICY_EMPTY); - addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list - why? + addAttribute("NumChannels", "value", DATATYPE_INTEGER, true, 0, Integer.MAX_VALUE); // list + // - + // why + // ? addElement("Gamma", "Chroma", CHILD_POLICY_EMPTY); addAttribute("Gamma", "value", DATATYPE_FLOAT, true, null); @@ -142,10 +146,8 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("BitsPerSample", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list addElement("SignificantBitsPerSample", "Data", CHILD_POLICY_EMPTY); - addAttribute( - "SignificantBitsPerSample", "value", - DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE - ); // list + addAttribute("SignificantBitsPerSample", "value", DATATYPE_INTEGER, true, 1, + Integer.MAX_VALUE); // list addElement("SampleMSB", "Data", CHILD_POLICY_EMPTY); addAttribute("SampleMSB", "value", DATATYPE_INTEGER, true, 1, Integer.MAX_VALUE); // list @@ -224,49 +226,29 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addElement("ImageCreationTime", "Document", CHILD_POLICY_EMPTY); addAttribute("ImageCreationTime", "year", DATATYPE_INTEGER, true, null); - addAttribute( - "ImageCreationTime", "month", - DATATYPE_INTEGER, true, null, "1", "12", true, true - ); - addAttribute( - "ImageCreationTime", "day", - DATATYPE_INTEGER, true, null, "1", "31", true, true - ); - addAttribute( - "ImageCreationTime", "hour", - DATATYPE_INTEGER, false, "0", "0", "23", true, true - ); - addAttribute( - "ImageCreationTime", "minute", - DATATYPE_INTEGER, false, "0", "0", "59", true, true - ); - addAttribute( - "ImageCreationTime", "second", - DATATYPE_INTEGER, false, "0", "0", "60", true, true - ); + addAttribute("ImageCreationTime", "month", DATATYPE_INTEGER, true, null, "1", "12", true, + true); + addAttribute("ImageCreationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true, + true); + addAttribute("ImageCreationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23", true, + true); + addAttribute("ImageCreationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59", true, + true); + addAttribute("ImageCreationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60", true, + true); addElement("ImageModificationTime", "Document", CHILD_POLICY_EMPTY); addAttribute("ImageModificationTime", "year", DATATYPE_INTEGER, true, null); - addAttribute( - "ImageModificationTime", "month", - DATATYPE_INTEGER, true, null, "1", "12", true, true - ); - addAttribute( - "ImageModificationTime", "day", - DATATYPE_INTEGER, true, null, "1", "31", true, true - ); - addAttribute( - "ImageModificationTime", "hour", - DATATYPE_INTEGER, false, "0", "0", "23", true, true - ); - addAttribute( - "ImageModificationTime", "minute", - DATATYPE_INTEGER, false, "0", "0", "59", true, true - ); - addAttribute( - "ImageModificationTime", "second", - DATATYPE_INTEGER, false, "0", "0", "60", true, true - ); + addAttribute("ImageModificationTime", "month", DATATYPE_INTEGER, true, null, "1", "12", + true, true); + addAttribute("ImageModificationTime", "day", DATATYPE_INTEGER, true, null, "1", "31", true, + true); + addAttribute("ImageModificationTime", "hour", DATATYPE_INTEGER, false, "0", "0", "23", + true, true); + addAttribute("ImageModificationTime", "minute", DATATYPE_INTEGER, false, "0", "0", "59", + true, true); + addAttribute("ImageModificationTime", "second", DATATYPE_INTEGER, false, "0", "0", "60", + true, true); // TEXT addElement("Text", standardMetadataFormatName, 0, Integer.MAX_VALUE); // CHILD_POLICY_REPEAT @@ -313,4 +295,3 @@ class IIOStandardMetadataFormat extends IIOMetadataFormatImpl { addAttribute("OpaqueTile", "y", DATATYPE_INTEGER, true, null); } } - diff --git a/awt/javax/imageio/metadata/package.html b/awt/javax/imageio/metadata/package.html new file mode 100644 index 0000000..29bd51b --- /dev/null +++ b/awt/javax/imageio/metadata/package.html @@ -0,0 +1,8 @@ +<html> + <body> + <p> + This package contains classes which allows to read and write describing metadata of image files. + </p> + @since Android 1.0 + </body> +</html> |