src/share/classes/javax/imageio/metadata/IIOMetadata.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 174                           String nativeMetadataFormatClassName,
 175                           String[] extraMetadataFormatNames,
 176                           String[] extraMetadataFormatClassNames) {
 177         this.standardFormatSupported = standardMetadataFormatSupported;
 178         this.nativeMetadataFormatName = nativeMetadataFormatName;
 179         this.nativeMetadataFormatClassName = nativeMetadataFormatClassName;
 180         if (extraMetadataFormatNames != null) {
 181             if (extraMetadataFormatNames.length == 0) {
 182                 throw new IllegalArgumentException
 183                     ("extraMetadataFormatNames.length == 0!");
 184             }
 185             if (extraMetadataFormatClassNames == null) {
 186                 throw new IllegalArgumentException
 187                     ("extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!");
 188             }
 189             if (extraMetadataFormatClassNames.length !=
 190                 extraMetadataFormatNames.length) {
 191                 throw new IllegalArgumentException
 192                     ("extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!");
 193             }
 194             this.extraMetadataFormatNames =
 195                 (String[]) extraMetadataFormatNames.clone();
 196             this.extraMetadataFormatClassNames =
 197                 (String[]) extraMetadataFormatClassNames.clone();
 198         } else {
 199             if (extraMetadataFormatClassNames != null) {
 200                 throw new IllegalArgumentException
 201                     ("extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!");
 202             }
 203         }
 204     }
 205 
 206     /**
 207      * Returns <code>true</code> if the standard metadata format is
 208      * supported by <code>getMetadataFormat</code>,
 209      * <code>getAsTree</code>, <code>setFromTree</code>, and
 210      * <code>mergeTree</code>.
 211      *
 212      * <p> The default implementation returns the value of the
 213      * <code>standardFormatSupported</code> instance variable.
 214      *
 215      * @return <code>true</code> if the standard metadata format
 216      * is supported.
 217      *


 268      * <code>getAsTree</code>, <code>setFromTree</code>, and
 269      * <code>mergeTree</code> methods.  If there are no such additional
 270      * formats, <code>null</code> is returned.
 271      *
 272      * <p> The default implementation returns a clone of the
 273      * <code>extraMetadataFormatNames</code> instance variable.
 274      *
 275      * @return an array of <code>String</code>s with length at least
 276      * 1, or <code>null</code>.
 277      *
 278      * @see #getAsTree
 279      * @see #setFromTree
 280      * @see #mergeTree
 281      * @see #getNativeMetadataFormatName
 282      * @see #getMetadataFormatNames
 283      */
 284     public String[] getExtraMetadataFormatNames() {
 285         if (extraMetadataFormatNames == null) {
 286             return null;
 287         }
 288         return (String[])extraMetadataFormatNames.clone();
 289     }
 290 
 291     /**
 292      * Returns an array of <code>String</code>s containing the names
 293      * of all metadata formats, including the native and standard
 294      * formats, recognized by this plug-in's <code>getAsTree</code>,
 295      * <code>setFromTree</code>, and <code>mergeTree</code> methods.
 296      * If there are no such formats, <code>null</code> is returned.
 297      *
 298      * <p> The default implementation calls
 299      * <code>getNativeMetadataFormatName</code>,
 300      * <code>isStandardMetadataFormatSupported</code>, and
 301      * <code>getExtraMetadataFormatNames</code> and returns the
 302      * combined results.
 303      *
 304      * @return an array of <code>String</code>s.
 305      *
 306      * @see #getNativeMetadataFormatName
 307      * @see #isStandardMetadataFormatSupported
 308      * @see #getExtraMetadataFormatNames


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 174                           String nativeMetadataFormatClassName,
 175                           String[] extraMetadataFormatNames,
 176                           String[] extraMetadataFormatClassNames) {
 177         this.standardFormatSupported = standardMetadataFormatSupported;
 178         this.nativeMetadataFormatName = nativeMetadataFormatName;
 179         this.nativeMetadataFormatClassName = nativeMetadataFormatClassName;
 180         if (extraMetadataFormatNames != null) {
 181             if (extraMetadataFormatNames.length == 0) {
 182                 throw new IllegalArgumentException
 183                     ("extraMetadataFormatNames.length == 0!");
 184             }
 185             if (extraMetadataFormatClassNames == null) {
 186                 throw new IllegalArgumentException
 187                     ("extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!");
 188             }
 189             if (extraMetadataFormatClassNames.length !=
 190                 extraMetadataFormatNames.length) {
 191                 throw new IllegalArgumentException
 192                     ("extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!");
 193             }
 194             this.extraMetadataFormatNames = extraMetadataFormatNames.clone();
 195             this.extraMetadataFormatClassNames = extraMetadataFormatClassNames.clone();


 196         } else {
 197             if (extraMetadataFormatClassNames != null) {
 198                 throw new IllegalArgumentException
 199                     ("extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!");
 200             }
 201         }
 202     }
 203 
 204     /**
 205      * Returns <code>true</code> if the standard metadata format is
 206      * supported by <code>getMetadataFormat</code>,
 207      * <code>getAsTree</code>, <code>setFromTree</code>, and
 208      * <code>mergeTree</code>.
 209      *
 210      * <p> The default implementation returns the value of the
 211      * <code>standardFormatSupported</code> instance variable.
 212      *
 213      * @return <code>true</code> if the standard metadata format
 214      * is supported.
 215      *


 266      * <code>getAsTree</code>, <code>setFromTree</code>, and
 267      * <code>mergeTree</code> methods.  If there are no such additional
 268      * formats, <code>null</code> is returned.
 269      *
 270      * <p> The default implementation returns a clone of the
 271      * <code>extraMetadataFormatNames</code> instance variable.
 272      *
 273      * @return an array of <code>String</code>s with length at least
 274      * 1, or <code>null</code>.
 275      *
 276      * @see #getAsTree
 277      * @see #setFromTree
 278      * @see #mergeTree
 279      * @see #getNativeMetadataFormatName
 280      * @see #getMetadataFormatNames
 281      */
 282     public String[] getExtraMetadataFormatNames() {
 283         if (extraMetadataFormatNames == null) {
 284             return null;
 285         }
 286         return extraMetadataFormatNames.clone();
 287     }
 288 
 289     /**
 290      * Returns an array of <code>String</code>s containing the names
 291      * of all metadata formats, including the native and standard
 292      * formats, recognized by this plug-in's <code>getAsTree</code>,
 293      * <code>setFromTree</code>, and <code>mergeTree</code> methods.
 294      * If there are no such formats, <code>null</code> is returned.
 295      *
 296      * <p> The default implementation calls
 297      * <code>getNativeMetadataFormatName</code>,
 298      * <code>isStandardMetadataFormatSupported</code>, and
 299      * <code>getExtraMetadataFormatNames</code> and returns the
 300      * combined results.
 301      *
 302      * @return an array of <code>String</code>s.
 303      *
 304      * @see #getNativeMetadataFormatName
 305      * @see #isStandardMetadataFormatSupported
 306      * @see #getExtraMetadataFormatNames