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

📄 jco$record.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            {
                return Short.parseShort(decodeNUM(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return Short.parseShort(decodeCHAR(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return Short.parseShort(decodeSTRING(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "short");
        else
            return 0;
    }

    public int getInt(int index)
    {
        checkRowCapacity();
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 8 || itype == 10 || itype == 9)
            return decodeINT(index);
        if((itype == 4 || itype == 30) && super.length[index] <= 4)
        {
            byte b[] = itype != 4 ? decodeXSTRING(index) : decodeBYTE(index);
            int value = 0;
            for(int i = 0; i < b.length; i++)
                value = value << 8 | b[i] & 0xff;

            return value;
        }
        if(itype == 6)
            try
            {
                return Integer.parseInt(decodeNUM(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return Integer.parseInt(decodeCHAR(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return Integer.parseInt(decodeSTRING(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "int");
        else
            return 0;
    }

    public long getLong(int index)
    {
        checkRowCapacity();
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 8 || itype == 10 || itype == 9)
            return (long)decodeINT(index);
        if((itype == 4 || itype == 30) && super.length[index] <= 8)
        {
            byte b[] = itype != 4 ? decodeXSTRING(index) : decodeBYTE(index);
            long value = 0L;
            for(int i = 0; i < b.length; i++)
                value = value << 8 | (long)b[i] & 255L;

            return value;
        }
        if(itype == 6)
            try
            {
                return Long.parseLong(decodeNUM(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return Long.parseLong(decodeCHAR(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return Long.parseLong(decodeSTRING(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "long");
        else
            return 0L;
    }

    public BigInteger getBigInteger(int index)
    {
        checkRowCapacity();
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 6)
            try
            {
                return new BigInteger(decodeNUM(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 8 || itype == 10 || itype == 9)
            try
            {
                return new BigInteger(Integer.toString(decodeINT(index)));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 2)
            try
            {
                return new BigInteger(decodeBCD(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return new BigInteger(decodeCHAR(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return new BigInteger(decodeSTRING(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "java.math.BigInteger");
        else
            return null;
    }

    public double getDouble(int index)
    {
        checkRowCapacity();
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 7)
            return decodeFLOAT(index);
        if(itype == 8 || itype == 10 || itype == 9)
            return (double)decodeINT(index);
        if(itype == 6)
            try
            {
                return Double.valueOf(decodeNUM(index)).doubleValue();
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 2)
            try
            {
                return Double.valueOf(decodeBCD(index)).doubleValue();
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return Double.valueOf(decodeCHAR(index)).doubleValue();
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return Double.valueOf(decodeSTRING(index)).doubleValue();
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "double");
        else
            return 0.0D;
    }

    public BigDecimal getBigDecimal(int index)
    {
        checkRowCapacity();
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 7)
            try
            {
                BigDecimal bd = new BigDecimal(decodeFLOAT(index));
                return bd.setScale(super.decimals[index], 6);
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 8 || itype == 10 || itype == 9)
            try
            {
                return new BigDecimal(decodeINT(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 6)
            try
            {
                return new BigDecimal(decodeNUM(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 2)
            try
            {
                return new BigDecimal(decodeBCD(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 0)
            try
            {
                return new BigDecimal(decodeCHAR(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            try
            {
                return new BigDecimal(decodeSTRING(index));
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
            conversion_error = true;
        if(conversion_error)
            throw createConversionException(index, "java.math.BigDecimal");
        else
            return null;
    }

    public Date getDate(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 1 || itype == 0 || itype == 29)
            return decodeDATE(index);
        if(itype == 3)
            return decodeTIME(index);
        else
            throw createConversionException(index, "java.util.Date");
    }

    public Date getTime(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 3 || itype == 0 || itype == 29)
            return decodeTIME(index);
        if(itype == 1)
            return decodeDATE(index);
        else
            throw createConversionException(index, "java.util.Date");
    }

    public byte[] getByteArray(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 0)
            return decodeCHAR(index).getBytes();
        if(itype == 4)
            return decodeBYTE(index);
        if(itype == 29)
            return decodeSTRING(index).getBytes();
        if(itype == 30)
            return decodeXSTRING(index);
        else
            throw createConversionException(index, "byte[]");
    }

    public char[] getCharArray(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 0)
            return decodeCHARARRAY(index);
        if(itype == 29)
        {
            String value = decodeSTRING(index);
            char result[] = new char[value.length()];
            value.getChars(0, value.length(), result, 0);
            return result;
        } else
        {
            throw createConversionException(index, "char[]");
        }
    }

    public InputStream getBinaryStream(int index)
    {
        checkRowCapacity();

⌨️ 快捷键说明

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