1 /*
   2  * Copyright (c) 2005, 2015, 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
  23  * questions.
  24  */
  25 
  26 package javax.imageio.plugins.tiff;
  27 
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 /**
  32  * A class representing the tags found in an Exif Interoperability IFD.
  33  *
  34  * @since 1.9
  35  * @see   ExifTIFFTagSet
  36  */
  37 public class ExifInteroperabilityTagSet extends TIFFTagSet {
  38     /**
  39      * A tag indicating the identification of the Interoperability rule
  40      * (type ASCII).
  41      *
  42      * @see #INTEROPERABILITY_INDEX_R98
  43      * @see #INTEROPERABILITY_INDEX_THM
  44      */
  45     public static final int TAG_INTEROPERABILITY_INDEX = 1;
  46 
  47     /**
  48      * A value to be used with the "InteroperabilityIndex" tag. Indicates
  49      * a file conforming to the R98 file specification of Recommended Exif
  50      * Interoperability Rules (ExifR98) or to the DCF basic file stipulated
  51      * by the Design Rule for Camera File System (type ASCII).
  52      *
  53      * @see #TAG_INTEROPERABILITY_INDEX
  54      */
  55     public static final String INTEROPERABILITY_INDEX_R98 = "R98";
  56 
  57     /**
  58      * A value to be used with the "InteroperabilityIndex" tag. Indicates
  59      * a file conforming to the DCF thumbnail file stipulated by the Design
  60      * rule for Camera File System (type ASCII).
  61      *
  62      * @see #TAG_INTEROPERABILITY_INDEX
  63      */
  64     public static final String INTEROPERABILITY_INDEX_THM = "THM";
  65 
  66     private static ExifInteroperabilityTagSet theInstance = null;
  67 
  68     static class InteroperabilityIndex extends TIFFTag {
  69 
  70         public InteroperabilityIndex() {
  71             super("InteroperabilityIndex",
  72                   TAG_INTEROPERABILITY_INDEX,
  73                   1 << TIFFTag.TIFF_ASCII);
  74         }
  75     }
  76 
  77     private static List<TIFFTag> tags;
  78 
  79     private static void initTags() {
  80         tags = new ArrayList<TIFFTag>(42);
  81 
  82         tags.add(new ExifInteroperabilityTagSet.InteroperabilityIndex());
  83     }
  84 
  85     private ExifInteroperabilityTagSet() {
  86         super(tags);
  87     }
  88 
  89     /**
  90      * Returns the shared instance of
  91      * <code>ExifInteroperabilityTagSet</code>.
  92      *
  93      * @return the <code>ExifInteroperabilityTagSet</code> instance.
  94      */
  95     public synchronized static ExifInteroperabilityTagSet getInstance() {
  96         if (theInstance == null) {
  97             initTags();
  98             theInstance = new ExifInteroperabilityTagSet();
  99             tags = null;
 100         }
 101         return theInstance;
 102     }
 103 }