2 * Copyright 2008 ZXing authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.google.zxing.common;
19 import java.util.Hashtable;
22 * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1
25 * @author srowen@google.com (Sean Owen)
27 public final class CharacterSetECI extends ECI {
29 private static final Hashtable VALUE_TO_ECI;
31 VALUE_TO_ECI = new Hashtable(29);
32 // TODO figure out if these values are even right!
33 addCharacterSet(0, "Cp437");
34 addCharacterSet(1, "ISO8859_1");
35 addCharacterSet(2, "Cp437");
36 addCharacterSet(3, "ISO8859_1");
37 addCharacterSet(4, "ISO8859_2");
38 addCharacterSet(5, "ISO8859_3");
39 addCharacterSet(6, "ISO8859_4");
40 addCharacterSet(7, "ISO8859_5");
41 addCharacterSet(8, "ISO8859_6");
42 addCharacterSet(9, "ISO8859_7");
43 addCharacterSet(10, "ISO8859_8");
44 addCharacterSet(11, "ISO8859_9");
45 addCharacterSet(12, "ISO8859_10");
46 addCharacterSet(13, "ISO8859_11");
47 addCharacterSet(15, "ISO8859_13");
48 addCharacterSet(16, "ISO8859_14");
49 addCharacterSet(17, "ISO8859_15");
50 addCharacterSet(18, "ISO8859_16");
51 addCharacterSet(20, "SJIS");
54 private final String encodingName;
56 private CharacterSetECI(int value, String encodingName) {
58 this.encodingName = encodingName;
61 public String getEncodingName() {
65 private static void addCharacterSet(int value, String encodingName) {
66 VALUE_TO_ECI.put(new Integer(value), new CharacterSetECI(value, encodingName));
69 public static CharacterSetECI getCharacterSetECIByValue(int value) {
70 CharacterSetECI eci = (CharacterSetECI) VALUE_TO_ECI.get(new Integer(value));
72 throw new IllegalArgumentException("Unsupported value: " + value);