⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smsgsmencoding.java

📁 试用JAVA通过COMM口发送短信的代码.
💻 JAVA
字号:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SMSGSMEncoding.java

package org.cross.sms.msg;


public class SMSGSMEncoding
{

    public SMSGSMEncoding()
    {
    }

    private static String char2Hex(char c, int charSet)
    {
        switch(charSet)
        {
        case 1: // '\001'
            for(int i = 0; i < "@?$\245\350\351\371\354\362\307\n\330\370\r\305\345\u8173\u7F6E\u901F\u80F8\u5C24\u8719\306\346\337\311 !\"#\244%&'()*+,-./0123456789:;<=>?\241ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\321\334\uE75Cu00BFabcdefghijklmnopqrstuvwxyz\344\366\361\374\340".length(); i++)
                if("@?$\245\350\351\371\354\362\307\n\330\370\r\305\345\u8173\u7F6E\u901F\u80F8\u5C24\u8719\306\346\337\311 !\"#\244%&'()*+,-./0123456789:;<=>?\241ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\321\334\uE75Cu00BFabcdefghijklmnopqrstuvwxyz\344\366\361\374\340".charAt(i) == c)
                    return i > 15 ? Integer.toHexString(i) : "0" + Integer.toHexString(i);

            break;
        }
        return Integer.toHexString(c).length() >= 2 ? Integer.toHexString(c) : "0" + Integer.toHexString(c);
    }

    public static char hex2Char(int index, int charSet)
    {
        switch(charSet)
        {
        case 1: // '\001'
            if(index < "@?$\245\350\351\371\354\362\307\n\330\370\r\305\345\u8173\u7F6E\u901F\u80F8\u5C24\u8719\306\346\337\311 !\"#\244%&'()*+,-./0123456789:;<=>?\241ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\321\334\uE75Cu00BFabcdefghijklmnopqrstuvwxyz\344\366\361\374\340".length())
                return "@?$\245\350\351\371\354\362\307\n\330\370\r\305\345\u8173\u7F6E\u901F\u80F8\u5C24\u8719\306\346\337\311 !\"#\244%&'()*+,-./0123456789:;<=>?\241ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\321\334\uE75Cu00BFabcdefghijklmnopqrstuvwxyz\344\366\361\374\340".charAt(index);
            else
                return '?';
        }
        return '?';
    }

    public static char hex2ExtChar(int ch, int charSet)
    {
        switch(charSet)
        {
        case 1: // '\001'
            switch(ch)
            {
            case 10: // '\n'
                return '\f';

            case 20: // '\024'
                return '^';

            case 40: // '('
                return '{';

            case 41: // ')'
                return '}';

            case 47: // '/'
                return '\\';

            case 60: // '<'
                return '[';

            case 61: // '='
                return '~';

            case 62: // '>'
                return ']';

            case 64: // '@'
                return '|';

            case 101: // 'e'
                return '\u20AC';
            }
            return '?';
        }
        return '?';
    }

    public static String text2Hex(String text, int charSet)
    {
        String outText = "";
        for(int i = 0; i < text.length(); i++)
            switch(text.charAt(i))
            {
            default:
                outText = outText + char2Hex(text.charAt(i), charSet);
                break;
            }

        return outText;
    }

    public static String hex2Text(String text, int charSet)
    {
        String outText = "";
        for(int i = 0; i < text.length(); i += 2)
        {
            String hexChar = "" + text.charAt(i) + text.charAt(i + 1);
            int c = Integer.parseInt(hexChar, 16);
            if(c == 27)
            {
                i++;
                outText = outText + hex2ExtChar((char)c, charSet);
            } else
            {
                outText = outText + hex2Char((char)c, charSet);
            }
        }

        return outText;
    }

    public static final int GSM7BITDEFAULT = 1;
    private static final String alphabet = "@?$\245\350\351\371\354\362\307\n\330\370\r\305\345\u8173\u7F6E\u901F\u80F8\u5C24\u8719\306\346\337\311 !\"#\244%&'()*+,-./0123456789:;<=>?\241ABCDEFGHIJKLMNOPQRSTUVWXYZ\304\326\321\334\uE75Cu00BFabcdefghijklmnopqrstuvwxyz\344\366\361\374\340";
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -