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

📄 sapnucbytetocharconverter.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            break MISSING_BLOCK_LABEL_853;
        }

        case 3: // '\003'
        {
            int tabIndex = (byteLength3ToCharOffset2[byteLength3ToCharOffset1[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff] | in[inIndex + 2] & 0xff) << 1;
            char outChar = byteLength3ToChar[tabIndex];
            if(outChar < '\uD800' || outChar > '\uDFFF')
            {
                if(outChar == '#')
                {
                    numBytes = 2;
                    break;
                }
                if(outChar == '\uF8FC' && byteLength3ToChar[tabIndex + 1] != 0)
                {
                    if(outIndex >= outEndIndex)
                    {
                        inIndex = inEndIndex + 1;
                        break;
                    }
                    out[outIndex++] = outChar;
                    outChar = byteLength3ToChar[tabIndex + 1];
                }
            } else
            {
                if(outIndex >= outEndIndex)
                {
                    inIndex = inEndIndex + 1;
                    break;
                }
                out[outIndex++] = outChar;
                outChar = byteLength3ToChar[tabIndex + 1];
            }
            out[outIndex++] = outChar;
            inIndex += 3;
            break MISSING_BLOCK_LABEL_853;
        }

        case 4: // '\004'
        {
            if(in[inIndex] == 27)
            {
                char sapIconChar1 = '\0';
                char sapIconChar2 = '\0';
                if(super.codepageType == 1 && in[inIndex + 1] == 44)
                {
                    sapIconChar1 = (char)(in[inIndex + 2] & 0xff);
                    sapIconChar2 = (char)(in[inIndex + 3] & 0xff);
                } else
                if(super.codepageType == 2 && in[inIndex + 1] == 107)
                {
                    sapIconChar1 = byteLength1ToCharLength1[in[inIndex + 2] & 0xff];
                    sapIconChar2 = byteLength1ToCharLength1[in[inIndex + 3] & 0xff];
                }
                if(sapIconChar1 != 0 && (sapIconChar1 >= '0' && sapIconChar1 <= '9' || sapIconChar1 >= 'A' && sapIconChar1 <= 'Z' || sapIconChar1 >= 'a' && sapIconChar1 <= 'z') && (sapIconChar2 >= '0' && sapIconChar2 <= '9' || sapIconChar2 >= 'A' && sapIconChar2 <= 'Z' || sapIconChar2 >= 'a' && sapIconChar2 <= 'z'))
                {
                    if(outIndex + 1 >= outEndIndex)
                    {
                        inIndex = inEndIndex + 1;
                        break;
                    }
                    out[outIndex++] = '\uF8FD';
                    out[outIndex++] = sapIconChar1;
                    out[outIndex++] = sapIconChar2;
                    inIndex += 4;
                    break MISSING_BLOCK_LABEL_853;
                }
            }
            numBytes = 3;
            break;
        }

        default:
        {
            numBytes = 4;
            break;
        }
        }
        continue; /* Loop/switch isn't completed */
        if(inIndex < inEndIndex)
        {
            numBytes = byteLength[byteLengthOffset[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff];
            if((inIndex + numBytes) - 1 > inEndIndex)
                numBytes = (byte)((inEndIndex - inIndex) + 1);
        } else
        {
            numBytes = 1;
        }
_L1:
        if(inIndex <= inEndIndex && outIndex <= outEndIndex) goto _L3; else goto _L2
_L2:
        return outIndex - outBeginIndex;
    }

    public char[] convert(byte in[], int inBeginIndex, int inEndIndex)
    {
        if(in == null)
            return new char[0];
        if(inBeginIndex < 0)
            return new char[0];
        if(inBeginIndex >= in.length)
            return new char[0];
        if(inEndIndex >= in.length)
            inEndIndex = in.length - 1;
        if(inBeginIndex > inEndIndex)
        {
            return new char[0];
        } else
        {
            int outLength = outLength(in, inBeginIndex, inEndIndex);
            char out[] = new char[outLength];
            convert(in, inBeginIndex, inEndIndex, out, 0, outLength - 1);
            return out;
        }
    }

    public char[] convert(byte in[])
    {
        if(in == null)
        {
            return new char[0];
        } else
        {
            int outLength = outLength(in, 0, in.length - 1);
            char out[] = new char[outLength];
            convert(in, 0, in.length - 1, out, 0, outLength - 1);
            return out;
        }
    }

    public int outLength(byte in[], int inBeginIndex, int inEndIndex)
    {
        int outLength;
        int inIndex;
        byte numBytes;
        if(in == null)
            return 0;
        if(inBeginIndex < 0)
            return 0;
        if(inBeginIndex >= in.length)
            return 0;
        if(inEndIndex >= in.length)
            inEndIndex = in.length - 1;
        if(inBeginIndex > inEndIndex)
            return 0;
        outLength = 0;
        inIndex = inBeginIndex;
        if(inIndex < inEndIndex)
        {
            numBytes = byteLength[byteLengthOffset[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff];
            if((inIndex + numBytes) - 1 > inEndIndex)
                numBytes = (byte)((inEndIndex - inIndex) + 1);
        } else
        {
            numBytes = 1;
        }
          goto _L1
_L3:
        switch(numBytes)
        {
        case 1: // '\001'
        {
            outLength++;
            inIndex++;
            break MISSING_BLOCK_LABEL_597;
        }

        case 2: // '\002'
        {
            int tabIndex = (byteLength2ToCharOffset[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff) << 1;
            char outChar = byteLength2ToChar[tabIndex];
            if(outChar < '\uD800' || outChar > '\uDFFF')
            {
                if(outChar == '#')
                {
                    numBytes = 1;
                    break;
                }
                if(outChar == '\uF8FC' && byteLength2ToChar[tabIndex + 1] != 0)
                    outLength++;
            } else
            {
                outLength++;
            }
            outLength++;
            inIndex += 2;
            break MISSING_BLOCK_LABEL_597;
        }

        case 3: // '\003'
        {
            int tabIndex = (byteLength3ToCharOffset2[byteLength3ToCharOffset1[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff] | in[inIndex + 2] & 0xff) << 1;
            char outChar = byteLength3ToChar[tabIndex];
            if(outChar < '\uD800' || outChar > '\uDFFF')
            {
                if(outChar == '#')
                {
                    numBytes = 2;
                    break;
                }
                if(outChar == '\uF8FC' && byteLength3ToChar[tabIndex + 1] != 0)
                    outLength++;
            } else
            {
                outLength++;
            }
            outLength++;
            inIndex += 3;
            break MISSING_BLOCK_LABEL_597;
        }

        case 4: // '\004'
        {
            if(in[inIndex] == 27)
            {
                char sapIconChar1 = '\0';
                char sapIconChar2 = '\0';
                if(super.codepageType == 1 && in[inIndex + 1] == 44)
                {
                    sapIconChar1 = (char)(in[inIndex + 2] & 0xff);
                    sapIconChar2 = (char)(in[inIndex + 3] & 0xff);
                } else
                if(super.codepageType == 2 && in[inIndex + 1] == 107)
                {
                    sapIconChar1 = byteLength1ToCharLength1[in[inIndex + 2] & 0xff];
                    sapIconChar2 = byteLength1ToCharLength1[in[inIndex + 3] & 0xff];
                }
                if(sapIconChar1 != 0 && (sapIconChar1 >= '0' && sapIconChar1 <= '9' || sapIconChar1 >= 'A' && sapIconChar1 <= 'Z' || sapIconChar1 >= 'a' && sapIconChar1 <= 'z') && (sapIconChar2 >= '0' && sapIconChar2 <= '9' || sapIconChar2 >= 'A' && sapIconChar2 <= 'Z' || sapIconChar2 >= 'a' && sapIconChar2 <= 'z'))
                {
                    outLength += 3;
                    inIndex += 4;
                    break MISSING_BLOCK_LABEL_597;
                }
            }
            numBytes = 3;
            break;
        }

        default:
        {
            numBytes = 4;
            break;
        }
        }
        continue; /* Loop/switch isn't completed */
        if(inIndex < inEndIndex)
        {
            numBytes = byteLength[byteLengthOffset[in[inIndex] & 0xff] | in[inIndex + 1] & 0xff];
            if((inIndex + numBytes) - 1 > inEndIndex)
                numBytes = (byte)((inEndIndex - inIndex) + 1);
        } else
        {
            numBytes = 1;
        }
_L1:
        if(inIndex <= inEndIndex) goto _L3; else goto _L2
_L2:
        return outLength;
    }

    public int outLength(byte in[])
    {
        if(in == null)
            return 0;
        else
            return outLength(in, 0, in.length - 1);
    }

    private static final byte TYPE_UNKNOWN = 0;
    private static final byte TYPE_BYTELENGTHOFFSET_ARRAY = 1;
    private static final byte TYPE_BYTELENGTH_ARRAY = 2;
    private static final byte TYPE_BYTELENGTH1TOCHARLENGTH1_ARRAY = 3;
    private static final byte TYPE_BYTELENGTH2TOCHAROFFSET_ARRAY = 4;
    private static final byte TYPE_BYTELENGTH2TOCHAR_ARRAY = 5;
    private static final byte TYPE_BYTELENGTH3TOCHAROFFSET1_ARRAY = 6;
    private static final byte TYPE_BYTELENGTH3TOCHAROFFSET2_ARRAY = 7;
    private static final byte TYPE_BYTELENGTH3TOCHAR_ARRAY = 8;
    private char byteLengthOffset[];
    private byte byteLength[];
    private char byteLength1ToCharLength1[];
    private char byteLength2ToCharOffset[];
    private char byteLength2ToChar[];
    private char byteLength3ToCharOffset1[];
    private int byteLength3ToCharOffset2[];
    private char byteLength3ToChar[];
}

⌨️ 快捷键说明

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