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.qrcode.decoder;
19 import java.util.Hashtable;
22 * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1.
24 * @author srowen@google.com (Sean Owen)
26 final class CharacterSetECI extends ECI {
28 private static final Hashtable VALUE_TO_ECI;
30 VALUE_TO_ECI = new Hashtable(29);
31 // TODO figure out if these values are even right!
32 addCharacterSet(0, "Cp437");
33 addCharacterSet(1, "ISO8859_1");
34 addCharacterSet(2, "Cp437");
35 addCharacterSet(3, "ISO8859_1");
36 addCharacterSet(4, "ISO8859_2");
37 addCharacterSet(5, "ISO8859_3");
38 addCharacterSet(6, "ISO8859_4");
39 addCharacterSet(7, "ISO8859_5");
40 addCharacterSet(8, "ISO8859_6");
41 addCharacterSet(9, "ISO8859_7");
42 addCharacterSet(10, "ISO8859_8");
43 addCharacterSet(11, "ISO8859_9");
44 addCharacterSet(12, "ISO8859_10");
45 addCharacterSet(13, "ISO8859_11");
46 addCharacterSet(15, "ISO8859_13");
47 addCharacterSet(16, "ISO8859_14");
48 addCharacterSet(17, "ISO8859_15");
49 addCharacterSet(18, "ISO8859_16");
50 addCharacterSet(20, "SJIS");
53 private final String encodingName;
55 private CharacterSetECI(int value, String encodingName) {
57 this.encodingName = encodingName;
60 String getEncodingName() {
64 private static void addCharacterSet(int value, String encodingName) {
65 VALUE_TO_ECI.put(new Integer(value), new CharacterSetECI(value, encodingName));
68 static CharacterSetECI getCharacterSetECIByValue(int value) {
69 CharacterSetECI eci = (CharacterSetECI) VALUE_TO_ECI.get(new Integer(value));
71 throw new IllegalArgumentException("Unsupported value: " + value);