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

📄 sapnucbytetocharconverter.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SAPNUCByteToCharConverter.java

package com.sap.mw.jco.util;

import com.sap.mw.jco.JCO;

// Referenced classes of package com.sap.mw.jco.util:
//            BasicSAPConverter, SAPByteToCharConverter

public class SAPNUCByteToCharConverter extends BasicSAPConverter
    implements SAPByteToCharConverter
{

    protected SAPNUCByteToCharConverter(String charEncoding)
    {
        super(charEncoding);
        byteLengthOffset = null;
        byteLength = null;
        byteLength1ToCharLength1 = null;
        byteLength2ToCharOffset = null;
        byteLength2ToChar = null;
        byteLength3ToCharOffset1 = null;
        byteLength3ToCharOffset2 = null;
        byteLength3ToChar = null;
        if(charEncoding.startsWith("SAP"))
            charEncoding = charEncoding.substring(3);
        if(nativeInitialize(charEncoding) != 0)
        {
            throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + charEncoding + ".");
        } else
        {
            initialize();
            return;
        }
    }

    protected native int nativeInitialize(String s);

    protected void initialize()
    {
        if(byteLength1ToCharLength1 != null)
        {
            int i;
            for(i = 32; i < 127; i++)
                if(byteLength1ToCharLength1[i] != i)
                    break;

            if(i == 127)
                super.codepageType = 1;
            else
                super.codepageType = 2;
        }
    }

    protected void setByteArray(byte type, String version, byte array[])
    {
        switch(type)
        {
        default:
            return;

        case 2: // '\002'
            if("1.0".equals(version))
            {
                byteLength = array;
                return;
            }
            // fall through

        case 1: // '\001'
        case 3: // '\003'
        case 4: // '\004'
        case 5: // '\005'
        case 6: // '\006'
        case 7: // '\007'
        case 8: // '\b'
            throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + super.charEncoding + ". SAP Java Connector runtime archive version " + version + " is required.");
        }
    }

    protected void setCharArray(byte type, String version, char array[])
    {
        switch(type)
        {
        case 1: // '\001'
            if("1.0".equals(version))
            {
                byteLengthOffset = array;
                return;
            }
            break;

        case 2: // '\002'
        case 7: // '\007'
            break;

        case 3: // '\003'
            if("1.0".equals(version))
            {
                byteLength1ToCharLength1 = array;
                return;
            }
            break;

        case 4: // '\004'
            if("1.0".equals(version))
            {
                byteLength2ToCharOffset = array;
                return;
            }
            break;

        case 5: // '\005'
            if("1.0".equals(version))
            {
                byteLength2ToChar = array;
                return;
            }
            break;

        case 6: // '\006'
            if("1.0".equals(version))
            {
                byteLength3ToCharOffset1 = array;
                return;
            }
            break;

        case 8: // '\b'
            if("1.0".equals(version))
            {
                byteLength3ToChar = array;
                return;
            }
            break;

        default:
            return;
        }
        throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + super.charEncoding + ". SAP Java Connector runtime archive version " + version + " is required.");
    }

    protected void setIntArray(byte type, String version, int array[])
    {
        switch(type)
        {
        default:
            return;

        case 7: // '\007'
            if("1.0".equals(version))
            {
                byteLength3ToCharOffset2 = array;
                return;
            }
            // fall through

        case 1: // '\001'
        case 2: // '\002'
        case 3: // '\003'
        case 4: // '\004'
        case 5: // '\005'
        case 6: // '\006'
        case 8: // '\b'
            throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + super.charEncoding + ". SAP Java Connector runtime archive version " + version + " is required.");
        }
    }

    protected void setLongArray(byte type, String version, long array[])
    {
        switch(type)
        {
        default:
            return;

        case 1: // '\001'
        case 2: // '\002'
        case 3: // '\003'
        case 4: // '\004'
        case 5: // '\005'
        case 6: // '\006'
        case 7: // '\007'
        case 8: // '\b'
            throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + super.charEncoding + ". SAP Java Connector runtime archive version " + version + " is required.");
        }
    }

    protected void setShortArray(byte type, String version, short array[])
    {
        switch(type)
        {
        default:
            return;

        case 1: // '\001'
        case 2: // '\002'
        case 3: // '\003'
        case 4: // '\004'
        case 5: // '\005'
        case 6: // '\006'
        case 7: // '\007'
        case 8: // '\b'
            throw new com.sap.mw.jco.JCO.Exception(134, "JCO_ERROR_INITIALIZATION", "Could not initialize SAPByteToCharConverter for codepage " + super.charEncoding + ". SAP Java Connector runtime archive version " + version + " is required.");
        }
    }

    public int convert(byte in[], int inBeginIndex, int inEndIndex, char out[], int outBeginIndex, int outEndIndex)
    {
        int inIndex;
        int outIndex;
        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;
        if(out == null)
            return 0;
        if(outBeginIndex < 0)
            return 0;
        if(outBeginIndex >= out.length)
            return 0;
        if(outEndIndex >= out.length)
            outEndIndex = out.length - 1;
        if(outBeginIndex > outEndIndex)
            return 0;
        inIndex = inBeginIndex;
        outIndex = outBeginIndex;
        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'
        {
            out[outIndex++] = byteLength1ToCharLength1[in[inIndex] & 0xff];
            inIndex++;
            break MISSING_BLOCK_LABEL_853;
        }

        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)
                {
                    if(outIndex >= outEndIndex)
                    {
                        inIndex = inEndIndex + 1;
                        break;
                    }
                    out[outIndex++] = outChar;
                    outChar = byteLength2ToChar[tabIndex + 1];
                }
            } else
            {
                if(outIndex >= outEndIndex)
                {
                    inIndex = inEndIndex + 1;
                    break;
                }
                out[outIndex++] = outChar;
                outChar = byteLength2ToChar[tabIndex + 1];
            }
            out[outIndex++] = outChar;
            inIndex += 2;

⌨️ 快捷键说明

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