FileDocCategorySizeDatePackage
IIOMetadata.javaAPI DocAndroid 1.5 API11635Wed May 06 22:41:54 BST 2009javax.imageio.metadata

IIOMetadata

public abstract class IIOMetadata extends Object
The class IIOMetadata represents the metadata (bundled with an image) as a Dom-type tree.
since
Android 1.0

Fields Summary
protected boolean
standardFormatSupported
Whether the standard metadata format is supported.
protected String
nativeMetadataFormatName
The native metadata format name.
protected String
nativeMetadataFormatClassName
The native metadata format class name.
protected String[]
extraMetadataFormatNames
The extra metadata format names.
protected String[]
extraMetadataFormatClassNames
The extra metadata format class names.
protected IIOMetadataController
defaultController
The default controller.
protected IIOMetadataController
controller
The controller.
Constructors Summary
protected IIOMetadata()
Instantiates a new IIOMetadata with no data set.

    
protected IIOMetadata(boolean standardMetadataFormatSupported, String nativeMetadataFormatName, String nativeMetadataFormatClassName, String[] extraMetadataFormatNames, String[] extraMetadataFormatClassNames)
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.

        standardFormatSupported = standardMetadataFormatSupported;
        this.nativeMetadataFormatName = nativeMetadataFormatName;
        this.nativeMetadataFormatClassName = nativeMetadataFormatClassName;
        if (extraMetadataFormatNames == null) {
            if (extraMetadataFormatClassNames != null) {
                throw new IllegalArgumentException(
                        "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!");
            }
        } else {
            if (extraMetadataFormatClassNames == null) {
                throw new IllegalArgumentException(
                        "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!");
            }
            this.extraMetadataFormatNames = extraMetadataFormatNames.clone();
            this.extraMetadataFormatClassNames = extraMetadataFormatClassNames.clone();
        }
    
Methods Summary
public booleanactivateController()
Activate the controller.

return
true, if successful.

        if (!hasController()) {
            throw new IllegalStateException("hasController() == false!");
        }
        return getController().activate(this);
    
public abstract org.w3c.dom.NodegetAsTree(java.lang.String formatName)
Gets the metadata as tree-type document.

param
formatName the format name.
return
the node in tree format.

public javax.imageio.metadata.IIOMetadataControllergetController()
Gets the controller associated with this metadata document.

return
the controller.

        return controller;
    
public javax.imageio.metadata.IIOMetadataControllergetDefaultController()
Gets the default controller.

return
the default controller.

        return defaultController;
    
public java.lang.String[]getExtraMetadataFormatNames()
Gets the extra metadata format names.

return
the extra metadata format names.

        return extraMetadataFormatNames == null ? null : extraMetadataFormatNames.clone();
    
public javax.imageio.metadata.IIOMetadataFormatgetMetadataFormat(java.lang.String formatName)
Gets the metadata format.

param
formatName the format name.
return
the metadata format.

        return IIOMetadataUtils.instantiateMetadataFormat(formatName, standardFormatSupported,
                nativeMetadataFormatName, nativeMetadataFormatClassName, extraMetadataFormatNames,
                extraMetadataFormatClassNames);
    
public java.lang.String[]getMetadataFormatNames()
Gets the metadata format names.

return
the metadata format names.

        ArrayList<String> res = new ArrayList<String>();

        String nativeMetadataFormatName = getNativeMetadataFormatName();
        boolean standardFormatSupported = isStandardMetadataFormatSupported();
        String extraMetadataFormatNames[] = getExtraMetadataFormatNames();

        if (standardFormatSupported) {
            res.add(IIOMetadataFormatImpl.standardMetadataFormatName);
        }
        if (nativeMetadataFormatName != null) {
            res.add(nativeMetadataFormatName);
        }
        if (extraMetadataFormatNames != null) {
            for (String extraMetadataFormatName : extraMetadataFormatNames) {
                res.add(extraMetadataFormatName);
            }
        }

        return res.size() > 0 ? res.toArray(new String[0]) : null;
    
public java.lang.StringgetNativeMetadataFormatName()
Gets the native metadata format name.

return
the native metadata format name.

        return nativeMetadataFormatName;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardChromaNode()
Gets the standard chroma node.

return
the standard chroma node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardCompressionNode()
Gets the standard compression node.

return
the standard compression node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardDataNode()
Gets the standard data node.

return
the standard data node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardDimensionNode()
Gets the standard dimension node.

return
the standard dimension node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardDocumentNode()
Gets the standard document node.

return
the standard document node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardTextNode()
Gets the standard text node.

return
the standard text node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardTileNode()
Gets the standard tile node.

return
the standard tile node.

        return null;
    
protected javax.imageio.metadata.IIOMetadataNodegetStandardTransparencyNode()
Gets the standard transparency node.

return
the standard transparency node.

        return null;
    
protected final javax.imageio.metadata.IIOMetadataNodegetStandardTree()
Gets the metadata as a tree in standard format.

return
the metadata as a tree in standard format.

        // Create root node
        IIOMetadataNode root = new IIOMetadataNode(IIOMetadataFormatImpl.standardMetadataFormatName);

        Node node;
        if ((node = getStandardChromaNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardCompressionNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardDataNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardDimensionNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardDocumentNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardTextNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardTileNode()) != null) {
            root.appendChild(node);
        }
        if ((node = getStandardTransparencyNode()) != null) {
            root.appendChild(node);
        }

        return root;
    
public booleanhasController()
Checks whether this metadata has a controller.

return
true, if this metadata has a controller.

        return getController() != null;
    
public abstract booleanisReadOnly()
Checks if the metadata is read only.

return
true, if the metadata is read only.

public booleanisStandardMetadataFormatSupported()
Checks if the standard metadata format is supported.

return
true, if the standard metadata format is supported.

        return standardFormatSupported;
    
public abstract voidmergeTree(java.lang.String formatName, org.w3c.dom.Node root)
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.

public abstract voidreset()
Resets the controller.

public voidsetController(javax.imageio.metadata.IIOMetadataController controller)
Sets the controller.

param
controller the new controller.

        this.controller = controller;
    
public voidsetFromTree(java.lang.String formatName, org.w3c.dom.Node root)
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.

        reset();
        mergeTree(formatName, root);