kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrStructType.java [57:96]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public XdrFieldInfo[] getXdrFieldInfos() {
        return fieldInfos;
    }

    @Override
    protected int encodingBodyLength() throws IOException {
        int allLen = 0;
        for (XdrType field : fields) {
            if (field != null) {
                allLen += field.encodingLength();
            }
        }
        return allLen;
    }

    @Override
    protected void encodeBody(ByteBuffer buffer) throws IOException {
        for (XdrType field : fields) {
            if (field != null) {
                field.encode(buffer);
            }
        }
    }

    @Override
    public void decode(ByteBuffer content) throws IOException {
        AbstractXdrType[] fields = getAllFields();
        Object[] value;
        for (XdrType field : fields) {
            if (field != null) {
                field.decode(content);
                int length = field.encodingLength();
                byte[] array = content.array();
                byte[] newArray = new byte[array.length - length];
                System.arraycopy(array, length, newArray, 0, array.length - length);
                content = ByteBuffer.wrap(newArray);
            }
        }
        this.fields = fields;
        setValue(fieldsToValues(fields));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



kerby-common/kerby-xdr/src/main/java/org/apache/kerby/xdr/type/XdrUnion.java [89:128]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public XdrFieldInfo[] getXdrFieldInfos() {
        return fieldInfos;
    }

    @Override
    protected int encodingBodyLength() throws IOException {
        int allLen = 0;
        for (XdrType field : fields) {
            if (field != null) {
                allLen += field.encodingLength();
            }
        }
        return allLen;
    }

    @Override
    protected void encodeBody(ByteBuffer buffer) throws IOException {
        for (XdrType field : fields) {
            if (field != null) {
                field.encode(buffer);
            }
        }
    }

    @Override
    public void decode(ByteBuffer content) throws IOException {
        AbstractXdrType[] fields = getAllFields();
        Object[] value;
        for (XdrType field : fields) {
            if (field != null) {
                field.decode(content);
                int length = field.encodingLength();
                byte[] array = content.array();
                byte[] newArray = new byte[array.length - length];
                System.arraycopy(array, length, newArray, 0, array.length - length);
                content = ByteBuffer.wrap(newArray);
            }
        }
        this.fields = fields;
        setValue(fieldsToValues(fields));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



