FileDocCategorySizeDatePackage
JPEGMetadataFormat.javaAPI DocJava SE 5 API4490Fri Aug 26 14:54:42 BST 2005com.sun.imageio.plugins.jpeg

JPEGMetadataFormat

public abstract class JPEGMetadataFormat extends IIOMetadataFormatImpl

Fields Summary
private static final int
MAX_JPEG_DATA_SIZE
String
resourceBaseName
Constructors Summary
JPEGMetadataFormat(String formatName, int childPolicy)


        
        super(formatName, childPolicy);
        setResourceBaseName(resourceBaseName);
    
Methods Summary
voidaddStreamElements(java.lang.String parentName)

        addElement("dqt", parentName, 1, 4);

        addElement("dqtable", "dqt", CHILD_POLICY_EMPTY);

        addAttribute("dqtable", 
                     "elementPrecision", 
                     DATATYPE_INTEGER,
                     false,
                     "0");
        List tabids = new ArrayList();
        tabids.add("0");
        tabids.add("1");
        tabids.add("2");
        tabids.add("3");
        addAttribute("dqtable", 
                     "qtableId", 
                     DATATYPE_INTEGER,
                     true,
                     null,
                     tabids);
        addObjectValue("dqtable", 
                       JPEGQTable.class,
                       true,
                       null);

        addElement("dht", parentName, 1, 4);
        addElement("dhtable", "dht", CHILD_POLICY_EMPTY);
        List classes = new ArrayList();
        classes.add("0");
        classes.add("1");
        addAttribute("dhtable", 
                     "class", 
                     DATATYPE_INTEGER,
                     true,
                     null,
                     classes);
        addAttribute("dhtable", 
                     "htableId", 
                     DATATYPE_INTEGER,
                     true,
                     null,
                     tabids);
        addObjectValue("dhtable", 
                       JPEGHuffmanTable.class,
                       true,
                       null);

        
        addElement("dri", parentName, CHILD_POLICY_EMPTY);
        addAttribute("dri", 
                     "interval", 
                     DATATYPE_INTEGER,
                     true,
                     null,
                     "0", "65535",
                     true, true);

        addElement("com", parentName, CHILD_POLICY_EMPTY);
        addAttribute("com", 
                     "comment",
                     DATATYPE_STRING,
                     false,
                     null);
        addObjectValue("com", byte[].class, 1, MAX_JPEG_DATA_SIZE);

        addElement("unknown", parentName, CHILD_POLICY_EMPTY);
        addAttribute("unknown", 
                     "MarkerTag",
                     DATATYPE_INTEGER,
                     true,
                     null,
                     "0", "255",
                     true, true);
        addObjectValue("unknown", byte[].class, 1, MAX_JPEG_DATA_SIZE);
    
public booleancanNodeAppear(java.lang.String elementName, javax.imageio.ImageTypeSpecifier imageType)

        // Just check if it appears in the format
        if (isInSubtree(elementName, getRootName())){
            return true;
        }
        return false;
    
protected booleanisInSubtree(java.lang.String elementName, java.lang.String subtreeName)
Returns true if the named element occurs in the subtree of the format starting with the node named by subtreeName, including the node itself. subtreeName may be any node in the format. If it is not, an IllegalArgumentException is thrown.

        if (elementName.equals(subtreeName)) {
            return true;
        }
        String [] children = getChildNames(elementName);
        for (int i=0; i < children.length; i++) {
            if (isInSubtree(elementName, children[i])) {
                return true;
            }
        }
        return false;