GSMCharset extends Charset { public static int octetsToSeptets(int byteCnt) { int septCnt = (byteCnt * 8 - 1) / 7 + 1; return septCnt; } GSMCharset(String canonicalName, String[] aliases);  GSMCharset(String canonicalName, String[] aliases, int[] mainTable, int[] extentionTable);  GSMCharset(String canonicalName, String[] aliases,
            NationalLanguageIdentifier nationalLanguageLockingShiftIdentifier,
            NationalLanguageIdentifier nationalLanguageSingleShiftIdentifier); @Override boolean contains(Charset cs); @Override CharsetDecoder newDecoder(); @Override CharsetEncoder newEncoder(); boolean checkAllCharsCanBeEncoded(String data); static boolean checkAllCharsCanBeEncoded(String data, int[] mainTable, int[] extentionTable); int checkEncodedDataLengthInChars(String data); static int checkEncodedDataLengthInChars(String data, int[] mainTable, int[] extentionTable); static int septetsToOctets(int septCnt); static int octetsToSeptets(int byteCnt); String[] sliceString(String data, int charCount); static String[] sliceString(String data, int charCount, int[] mainTable, int[] extentionTable); static final String GSM_CANONICAL_NAME; static final byte ESCAPE; static final int[] basicMap; static final int[] basicExtentionMap; static Charset gsm7CharsetDefault; static final int[] spanishExtentionMap; static Charset gsm7CharsetSpanish; static final int[] portugeseMap; static final int[] portugeseExtentionMap; static Charset gsm7CharsetPortugese; static final int[] turkishMap; static final int[] turkishExtentionMap; static Charset gsm7CharsetTurkish; static final int[] urduMap; static final int[] urduExtentionMap; static Charset gsm7CharsetUrdu; static final int[] hindiMap; static final int[] hindiExtentionMap; static Charset gsm7CharsetHindi; static final int[] bengaliMap; static final int[] bengaliExtentionMap; static Charset gsm7CharsetBengali; static final int[] punjabiMap; static final int[] punjabiExtentionMap; static Charset gsm7CharsetPunjabi; static final int[] gujaratiMap; static final int[] gujaratiExtentionMap; static Charset gsm7CharsetGujarati; static final int[] oriyaMap; static final int[] oriyaExtentionMap; static Charset gsm7CharsetOriya; static final int[] tamilMap; static final int[] tamilExtentionMap; static Charset gsm7CharsetTamil; static final int[] teluguMap; static final int[] teluguExtentionMap; static Charset gsm7CharsetTelugu; static final int[] kannadaMap; static final int[] kannadaExtentionMap; static Charset gsm7CharsetKannada; static final int[] malayalamMap; static final int[] malayalamExtentionMap; static Charset gsm7CharsetMalayalam; }
@Test(groups = { "functional.decode", "datacoding" }) public void testDecode() throws Exception { int octetOffset = 8; int septetOffset = GSMCharset.octetsToSeptets(octetOffset); this.doTestDecode("123456\r", new byte[] { 49, -39, -116, 86, -77, 53, 26 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("1\r", new byte[] { -79, 6 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("1", new byte[] { 49 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("1234567", new byte[] { 49, -39, -116, 86, -77, -35, 26 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("1234567\r\r", new byte[] { 49, -39, -116, 86, -77, -35, 26, 13 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("1234567", new byte[] { 49, -39, -116, 86, -77, -35, 0 }, Gsm7EncodingStyle.bit7_sms_style, 7, 0); this.doTestDecode("1234567\r", new byte[] { 49, -39, -116, 86, -77, -35, 26 }, Gsm7EncodingStyle.bit7_sms_style, 8, 0); this.doTestDecode("*125*+31628839999#", new byte[] { (byte) 0xaa, (byte) 0x98, (byte) 0xac, (byte) 0xa6, 0x5a, (byte) 0xcd, 0x62, 0x36, 0x19, 0x0e, 0x37, (byte) 0xcb, (byte) 0xe5, 0x72, (byte) 0xb9, 0x11 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("You don t have enough credit to call this number. ", new byte[] { (byte) 0xd9, (byte) 0x77, 0x1d, 0x44, (byte) 0x7e, (byte) 0xbb, 0x41, 0x74, 0x10, 0x3a, 0x6c, 0x2f, (byte) 0x83, (byte) 0xca, (byte) 0xee, 0x77, (byte) 0xfd, (byte) 0x8c, 0x06, (byte) 0x8d, (byte) 0xe5, 0x65, 0x72, (byte) 0x9a, 0x0e, (byte) 0xa2, (byte) 0xbf, 0x41, (byte) 0xe3, 0x30, (byte) 0x9b, 0x0d, (byte) 0xa2, (byte) 0xa3, (byte) 0xd3, 0x73, (byte) 0x90, (byte) 0xbb, (byte) 0xde, 0x16, (byte) 0x97, (byte) 0xe5, 0x2e, 0x10 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("ndmgapp2ndmgapp2", new byte[] { 0x6e, 0x72, (byte) 0xfb, 0x1c, (byte) 0x86, (byte) 0xc3, 0x65, 0x6e, 0x72, (byte) 0xfb, 0x1c, (byte) 0x86, (byte) 0xc3, 0x65 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("*88#", new byte[] { 0x2a, 0x1c, 0x6e, (byte) 0xd4 }, Gsm7EncodingStyle.bit7_ussd_style, 0, 0); this.doTestDecode("[88]", new byte[] { 27, 30, 14, -73, -15, 1 }, Gsm7EncodingStyle.bit7_sms_style, 6, 0); this.doTestDecode("[88]", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, -64, -122, -121, -61, 109, 124 }, Gsm7EncodingStyle.bit7_sms_style, 16, septetOffset); this.doTestDecode("Hell", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 0, -78, -52, 102, 3 }, Gsm7EncodingStyle.bit7_sms_style, 14, septetOffset); this.doTestDecode("Hell", new byte[] { 72, 101, 108, 108 }, Gsm7EncodingStyle.bit8_smpp_style, 0, 0); this.doTestDecode("Hell", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 72, 101, 108, 108 }, Gsm7EncodingStyle.bit8_smpp_style, 0, octetOffset); this.doTestDecode("[88]", new byte[] { 27, 60, 56, 56, 27, 62 }, Gsm7EncodingStyle.bit8_smpp_style, 0, 0); this.doTestDecode("[88]", new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 27, 60, 56, 56, 27, 62 }, Gsm7EncodingStyle.bit8_smpp_style, 0, octetOffset); this.doTestDecode("He l", new byte[] { 72, 101, (byte) 200, 108 }, Gsm7EncodingStyle.bit8_smpp_style, 0, 0); }