    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.imaging.formats.png;
    018
    019public abstract class PngText {
    020    public final String keyword;
    021    public final String text;
    022
    023    public PngText(final String keyword, final String text) {
    024        this.keyword = keyword;
    025        this.text = text;
    026    }
    027
    028    public static class Text extends PngText {
    029        public Text(final String keyword, final String text) {
    030            super(keyword, text);
    031        }
    032    }
    033
    034    public static class Ztxt extends PngText {
    035        public Ztxt(final String keyword, final String text) {
    036            super(keyword, text);
    037        }
    038    }
    039
    040    public static class Itxt extends PngText {
    041
    042        /*
    043         * The language tag defined in [RFC-3066] indicates the human language
    044         * used by the translated keyword and the text. Unlike the keyword, the
    045         * language tag is case-insensitive. It is an ISO 646.IRV:1991 [ISO 646]
    046         * string consisting of hyphen-separated words of 1-8 alphanumeric
    047         * characters each (for example cn, en-uk, no-bok, x-klingon,
    048         * x-KlInGoN). If the first word is two or three letters long, it is an
    049         * ISO language code [ISO-639]. If the language tag is empty, the
    050         * language is unspecified.
    051         */
    052        public final String languageTag;
    053
    054        public final String translatedKeyword;
    055
    056        public Itxt(final String keyword, final String text, final String languageTag, final String translatedKeyword) {
    057            super(keyword, text);
    058            this.languageTag = languageTag;
    059            this.translatedKeyword = translatedKeyword;
    060        }
    061    }
    062
    063}