Path: blob/master/src/java.desktop/share/classes/javax/imageio/plugins/tiff/FaxTIFFTagSet.java
44021 views
/*1* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package javax.imageio.plugins.tiff;2526import java.util.ArrayList;27import java.util.List;2829/**30* A class representing the extra tags found in a31* <a href="http://tools.ietf.org/html/rfc2306.html">TIFF-F</a> (RFC 2036) file.32*33* @since 934*/35public final class FaxTIFFTagSet extends TIFFTagSet {3637private static FaxTIFFTagSet theInstance = null;3839/** Tag indicating the number of bad fax lines (type SHORT or LONG). */40public static final int TAG_BAD_FAX_LINES = 326;4142/**43* Tag indicating the number of lines of clean fax data (type44* SHORT).45*46* @see #CLEAN_FAX_DATA_NO_ERRORS47* @see #CLEAN_FAX_DATA_ERRORS_CORRECTED48* @see #CLEAN_FAX_DATA_ERRORS_UNCORRECTED49*/50public static final int TAG_CLEAN_FAX_DATA = 327;5152/**53* A value to be used with the "CleanFaxData" tag.54*55* @see #TAG_CLEAN_FAX_DATA56*/57public static final int CLEAN_FAX_DATA_NO_ERRORS = 0;5859/**60* A value to be used with the "CleanFaxData" tag.61*62* @see #TAG_CLEAN_FAX_DATA63*/64public static final int CLEAN_FAX_DATA_ERRORS_CORRECTED = 1;6566/**67* A value to be used with the "CleanFaxData" tag.68*69* @see #TAG_CLEAN_FAX_DATA70*/71public static final int CLEAN_FAX_DATA_ERRORS_UNCORRECTED = 2;7273/**74* Tag indicating the number of consecutive bad lines (type75* SHORT or LONG).76*/77public static final int TAG_CONSECUTIVE_BAD_LINES = 328;7879static class BadFaxLines extends TIFFTag {8081public BadFaxLines() {82super("BadFaxLines",83TAG_BAD_FAX_LINES,841 << TIFF_SHORT |851 << TIFF_LONG,861);87}88}8990static class CleanFaxData extends TIFFTag {9192public CleanFaxData() {93super("CleanFaxData",94TAG_CLEAN_FAX_DATA,951 << TIFF_SHORT,961);9798addValueName(CLEAN_FAX_DATA_NO_ERRORS,99"No errors");100addValueName(CLEAN_FAX_DATA_ERRORS_CORRECTED,101"Errors corrected");102addValueName(CLEAN_FAX_DATA_ERRORS_UNCORRECTED,103"Errors uncorrected");104}105}106107static class ConsecutiveBadFaxLines extends TIFFTag {108109public ConsecutiveBadFaxLines() {110super("ConsecutiveBadFaxLines",111TAG_CONSECUTIVE_BAD_LINES,1121 << TIFF_SHORT |1131 << TIFF_LONG,1141);115}116}117118private static List<TIFFTag> tags;119120private static void initTags() {121tags = new ArrayList<TIFFTag>(42);122123tags.add(new FaxTIFFTagSet.BadFaxLines());124tags.add(new FaxTIFFTagSet.CleanFaxData());125tags.add(new FaxTIFFTagSet.ConsecutiveBadFaxLines());126}127128private FaxTIFFTagSet() {129super(tags);130}131132/**133* Returns a shared instance of a {@code FaxTIFFTagSet}.134*135* @return a {@code FaxTIFFTagSet} instance.136*/137public synchronized static FaxTIFFTagSet getInstance() {138if (theInstance == null) {139initTags();140theInstance = new FaxTIFFTagSet();141tags = null;142}143return theInstance;144}145}146147148