/* * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.imageio.plugins.tiff; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; /** * A class representing a set of TIFF tags. Each tag in the set must * have a unique number (this is a limitation of the TIFF * specification itself). * *
This class and its subclasses are responsible for mapping
* between raw tag numbers and The returned object is unmodifiable and contains the tag
* numbers of all The returned object is unmodifiable and contains the tag
* names of all TIFFTag
objects, which
* contain additional information about each tag, such as the tag's
* name, legal data types, and mnemonic names for some or all of ts
* data values.
*
* @since 9
* @see TIFFTag
*/
public class TIFFTagSet {
private SortedMapTIFFTagSet
, given a List
* of TIFFTag
objects.
*
* @param tags a List
object containing
* TIFFTag
objects to be added to this tag set.
*
* @throws IllegalArgumentException if tags
is
* null
, or contains objects that are not instances
* of the TIFFTag
class.
*/
public TIFFTagSet(ListTIFFTag
from this set that is
* associated with the given tag number, or null
if
* no tag exists for that number.
*
* @param tagNumber the number of the tag to be retrieved.
*
* @return the numbered TIFFTag
, or null
.
*/
public TIFFTag getTag(int tagNumber) {
return allowedTagsByNumber.get(Integer.valueOf(tagNumber));
}
/**
* Returns the TIFFTag
having the given tag name, or
* null
if the named tag does not belong to this tag set.
*
* @param tagName the name of the tag to be retrieved, as a
* String
.
*
* @return the named TIFFTag
, or null
.
*
* @throws IllegalArgumentException if tagName
is
* null
.
*/
public TIFFTag getTag(String tagName) {
if (tagName == null) {
throw new IllegalArgumentException("tagName == null!");
}
return allowedTagsByName.get(tagName);
}
/**
* Retrieves an unmodifiable numerically increasing set of tag numbers.
*
* TIFFTag
s in this TIFFTagSet
* sorted into ascending order according to
* {@link Integer#compareTo(Object)}.TIFFTag
s in this TIFFTagSet
* sorted into ascending order according to
* {@link String#compareTo(Object)}.