View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.imaging.formats.png;
18  
19  public abstract class AbstractPngText {
20      public static class Itxt extends AbstractPngText {
21  
22          /*
23           * The language tag defined in [RFC-3066] indicates the human language used by the translated keyword and the text. Unlike the keyword, the language tag
24           * is case-insensitive. It is an ISO 646.IRV:1991 [ISO 646] string consisting of hyphen-separated words of 1-8 alphanumeric characters each (for example
25           * cn, en-uk, no-bok, x-klingon, x-KlInGoN). If the first word is two or three letters long, it is an ISO language code [ISO-639]. If the language tag
26           * is empty, the language is unspecified.
27           */
28          public final String languageTag;
29  
30          public final String translatedKeyword;
31  
32          public Itxt(final String keyword, final String text, final String languageTag, final String translatedKeyword) {
33              super(keyword, text);
34              this.languageTag = languageTag;
35              this.translatedKeyword = translatedKeyword;
36          }
37      }
38  
39      public static class Text extends AbstractPngText {
40          public Text(final String keyword, final String text) {
41              super(keyword, text);
42          }
43      }
44  
45      public static class Ztxt extends AbstractPngText {
46          public Ztxt(final String keyword, final String text) {
47              super(keyword, text);
48          }
49      }
50  
51      public final String keyword;
52  
53      public final String text;
54  
55      public AbstractPngText(final String keyword, final String text) {
56          this.keyword = keyword;
57          this.text = text;
58      }
59  
60  }