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

📄 jco$record.java

📁 SAP这个系统的一个转换器
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        int itype = super.type[index];
        if(itype == 4)
            return new ByteArrayInputStream(decodeBYTE(index));
        if(itype == 30)
            return new ByteArrayInputStream(decodeXSTRING(index));
        if(itype == 0)
            return new ByteArrayInputStream(decodeCHAR(index).getBytes());
        if(itype == 29)
            return new ByteArrayInputStream(decodeSTRING(index).getBytes());
        else
            throw createConversionException(index, "java.io.InputStream");
    }

    public Reader getCharacterStream(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 0)
            return new StringReader(decodeCHAR(index));
        if(itype == 29)
            return new StringReader(decodeSTRING(index));
        else
            throw createConversionException(index, "java.io.Reader");
    }

    public JCO$Table getTable(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 99)
            return decodeTABLE(index);
        else
            throw createConversionException(index, "JCO.Table");
    }

    public re getStructure(int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 17)
            return decodeSTRUCTURE(index);
        else
            throw createConversionException(index, "JCO.Structure");
    }

    protected String getHTMLString(int index)
    {
        String s = getString(index);
        if(s == null)
            return " ";
        s = s.trim();
        if(s.length() == 0)
            return " ";
        StringBuffer sb = new StringBuffer();
        for(int i = 0; i < s.length(); i++)
        {
            char c = s.charAt(i);
            if(c == ' ')
                sb.append("&nbsp;");
            else
            if(c < '\200' && (c != '&') & (c != '<'))
                sb.append(c);
            else
                sb.append("&#" + (int)c + ";");
        }

        return sb.toString();
    }

    public String toXML(int index)
    {
        try
        {
            if(super.type[index] == 17)
                return XMLWriter.createXMLDocument(decodeSTRUCTURE(index), super.name[index]);
            if(super.type[index] == 99)
                return XMLWriter.createXMLDocument(decodeTABLE(index), super.name[index]);
            else
                return (new XMLWriter()).element(index).toString();
        }
        catch(on ex1)
        {
            throw ex1;
        }
        catch(Exception ex2)
        {
            throw createConversionException(index, "XML");
        }
    }

    public String toXML(String field_name)
    {
        return toXML(indexOf(field_name));
    }

    public String toXML()
    {
        return XMLWriter.createXMLDocument(this, super.rec_name);
    }

    public void fromXML(String data)
    {
        XMLReader reader = new XMLReader(this);
        reader.parse(data);
    }

    private void fromCharArray(char data[])
    {
        XMLReader reader = new XMLReader(this);
        reader.parse(data, 0, data.length);
    }

    public void setValue(String value, int index)
    {
        checkRowCapacity();
        if(value == null || value.length() == 0)
        {
            setDefault(index);
            return;
        }
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 0)
            encodeCHAR(value, index);
        else
        if(itype == 10 || itype == 9 || itype == 8)
            try
            {
                encodeINT(Integer.parseInt(value), index);
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 7)
            try
            {
                Double dble = new Double(value.length() <= 0 ? "0" : value);
                encodeFLOAT(dble.doubleValue(), index);
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 6)
            try
            {
                encodeNUM(value, index);
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 2)
            encodeBCD(value.length() <= 0 ? "0" : value, index);
        else
        if(itype == 1)
            try
            {
                encodeDATE(value, index);
            }
            catch(Exception ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 3)
            try
            {
                encodeTIME(value, index);
            }
            catch(Exception ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 4)
            try
            {
                encodeBYTE(com.sap.mw.jco.util.Codecs$Hex.decode(value), index);
            }
            catch(NumberFormatException ex)
            {
                conversion_error = true;
            }
        else
        if(itype == 29)
            encodeSTRING(value, index);
        else
        if(itype == 30)
            encodeXSTRING(com.sap.mw.jco.util.Codecs$Hex.decode(value), index);
        else
            conversion_error = true;
        if(conversion_error)
        {
            throw createConversionException(index, "java.lang.String", value);
        } else
        {
            super.flags[index] &= 0xf7;
            setModified(row);
            return;
        }
    }

    public final JCO$Field getField(String field_name)
    {
        return new JCO$Field(this, indexOf(field_name));
    }

    public final String getClassNameOfValue(String field_name)
    {
        return getClassNameOfValue(indexOf(field_name));
    }

    public final Object getValue(String field_name)
    {
        return getValue(indexOf(field_name));
    }

    public final String getString(String field_name)
    {
        return getString(indexOf(field_name));
    }

    public final char getChar(String field_name)
    {
        return getChar(indexOf(field_name));
    }

    public final short getShort(String field_name)
    {
        return getShort(indexOf(field_name));
    }

    public final int getInt(String field_name)
    {
        return getInt(indexOf(field_name));
    }

    public final long getLong(String field_name)
    {
        return getLong(indexOf(field_name));
    }

    public final BigInteger getBigInteger(String field_name)
    {
        return getBigInteger(indexOf(field_name));
    }

    public final double getDouble(String field_name)
    {
        return getDouble(indexOf(field_name));
    }

    public final BigDecimal getBigDecimal(String field_name)
    {
        return getBigDecimal(indexOf(field_name));
    }

    public final Date getDate(String field_name)
    {
        return getDate(indexOf(field_name));
    }

    public final Date getTime(String field_name)
    {
        return getTime(indexOf(field_name));
    }

    public final byte[] getByteArray(String field_name)
    {
        return getByteArray(indexOf(field_name));
    }

    public final char[] getCharArray(String field_name)
    {
        return getCharArray(indexOf(field_name));
    }

    public final InputStream getBinaryStream(String field_name)
    {
        return getBinaryStream(indexOf(field_name));
    }

    public final Reader getCharacterStream(String field_name)
    {
        return getCharacterStream(indexOf(field_name));
    }

    public final JCO$Table getTable(String field_name)
    {
        return getTable(indexOf(field_name));
    }

    public final re getStructure(String field_name)
    {
        return getStructure(indexOf(field_name));
    }

    protected void setDefault(int index)
    {
        int itype = super.type[index];
        if(itype == 0)
            encodeCHAR("", index);
        else
        if(itype == 8 || itype == 9 || itype == 10)
            encodeINT(0, index);
        else
        if(itype == 1)
            encodeCHAR("00000000", index);
        else
        if(itype == 3)
            encodeCHAR("000000", index);
        else
        if(itype == 6)
            try
            {
                encodeNUM(0L, index);
            }
            catch(on ex) { }
        else
        if(itype == 7)
            encodeFLOAT(0.0D, index);
        else
        if(itype == 2)
            encodeBCD("0", index);
        else
        if(itype == 4)
            encodeBYTE(new byte[1], index);
        else
        if(itype == 29)
            encodeSTRING("", index);
        else
        if(itype == 30)
            encodeXSTRING(new byte[1], index);
        else
            return;
        super.flags[index] &= 0xf7;
        setModified(row);
    }

    public void setValue(char value, int index)
    {
        setValue(new String(new char[] {
            value
        }), index);
    }

    public void setValue(char value[], int index)
    {
        setValue(value, 0, value.length, index);
    }

    public void setValue(char value[], int from, int length, int index)
    {
        checkRowCapacity();
        if(value == null || length == 0)
        {
            setDefault(index);
            return;
        }
        if(length < 0)
            throw new on(131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Illegal length [" + length + "] was passed. Current field " + super.name[index]);
        if(value.length < from + length)
            throw new on(131, "JCO_ERROR_ILLEGAL_ARGUMENT", "Array length [" + value.length + "] less than length was passed [" + (from + length) + "]. Currentat field " + super.name[index]);
        boolean conversion_error = false;
        int itype = super.type[index];
        if(itype == 0)
            encodeCHARS(value, from, length, index);
        else
        if(itype == 29)
            encodeSTRING(new String(value, from, length), index);
        else
            conversion_error = true;
        if(conversion_error)
        {
            throw createConversionException(index, "char[]", new String(value, from, length));
        } else
        {
            super.flags[index] &= 0xf7;
            setModified(row);
            return;
        }
    }

    public void setValue(short value, int index)
    {
        checkRowCapacity();
        int itype = super.type[index];
        if(itype == 8 || itype == 9 || 

⌨️ 快捷键说明

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