diff --git a/core/src/com/google/zxing/qrcode/decoder/CharacterSetECI.java b/core/src/com/google/zxing/qrcode/decoder/CharacterSetECI.java deleted file mode 100644 index 3d2d582ad..000000000 --- a/core/src/com/google/zxing/qrcode/decoder/CharacterSetECI.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2008 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.qrcode.decoder; - -import java.util.Hashtable; - -/** - * Encapsulates a Character Set ECI, according to "Extended Channel Interpretations" 5.3.1.1. - * - * @author srowen@google.com (Sean Owen) - */ -final class CharacterSetECI extends ECI { - - private static final Hashtable VALUE_TO_ECI; - static { - VALUE_TO_ECI = new Hashtable(29); - // TODO figure out if these values are even right! - addCharacterSet(0, "Cp437"); - addCharacterSet(1, "ISO8859_1"); - addCharacterSet(2, "Cp437"); - addCharacterSet(3, "ISO8859_1"); - addCharacterSet(4, "ISO8859_2"); - addCharacterSet(5, "ISO8859_3"); - addCharacterSet(6, "ISO8859_4"); - addCharacterSet(7, "ISO8859_5"); - addCharacterSet(8, "ISO8859_6"); - addCharacterSet(9, "ISO8859_7"); - addCharacterSet(10, "ISO8859_8"); - addCharacterSet(11, "ISO8859_9"); - addCharacterSet(12, "ISO8859_10"); - addCharacterSet(13, "ISO8859_11"); - addCharacterSet(15, "ISO8859_13"); - addCharacterSet(16, "ISO8859_14"); - addCharacterSet(17, "ISO8859_15"); - addCharacterSet(18, "ISO8859_16"); - addCharacterSet(20, "SJIS"); - } - - private final String encodingName; - - private CharacterSetECI(int value, String encodingName) { - super(value); - this.encodingName = encodingName; - } - - String getEncodingName() { - return encodingName; - } - - private static void addCharacterSet(int value, String encodingName) { - VALUE_TO_ECI.put(new Integer(value), new CharacterSetECI(value, encodingName)); - } - - static CharacterSetECI getCharacterSetECIByValue(int value) { - CharacterSetECI eci = (CharacterSetECI) VALUE_TO_ECI.get(new Integer(value)); - if (eci == null) { - throw new IllegalArgumentException("Unsupported value: " + value); - } - return eci; - } - -} \ No newline at end of file diff --git a/core/src/com/google/zxing/qrcode/decoder/ECI.java b/core/src/com/google/zxing/qrcode/decoder/ECI.java deleted file mode 100644 index 96a1aeed3..000000000 --- a/core/src/com/google/zxing/qrcode/decoder/ECI.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.qrcode.decoder; - -import com.google.zxing.common.BitSource; - -/** - * Superclass of classes encapsulating types ECIs, according to "Extended Channel Interpretations" 5.3. - * - * @author srowen@google.com (Sean Owen) - */ -abstract class ECI { - - private final int value; - - ECI(int value) { - this.value = value; - } - - int getValue() { - return value; - } - - static ECI getECIByValue(int value) { - if (value < 0 || value > 999999) { - throw new IllegalArgumentException("Bad ECI value: " + value); - } - if (value < 900) { // Character set ECIs use 000000 - 000899 - return CharacterSetECI.getCharacterSetECIByValue(value); - } - throw new IllegalArgumentException("Unsupported ECI value: " + value); - } - - static int parseECI(BitSource bits) { - int firstByte = bits.readBits(8); - if ((firstByte & 0x80) == 0) { - // just one byte - return firstByte & 0x7F; - } else if ((firstByte & 0xC0) == 0x80) { - // two bytes - int secondByte = bits.readBits(8); - return ((firstByte & 0x3F) << 8) | secondByte; - } else if ((firstByte & 0xE0) == 0xC0) { - // three bytes - int secondThirdBytes = bits.readBits(16); - return ((firstByte & 0x1F) << 16) | secondThirdBytes; - } - throw new IllegalArgumentException("Bad ECI bits starting with byte " + firstByte); - } - -}