Android XML Serializer Write writeIntArrayXml(int[] val, String name, XmlSerializer out)

Here you can find the source of writeIntArrayXml(int[] val, String name, XmlSerializer out)

Description

write Int Array Xml

Declaration

public static final void writeIntArrayXml(int[] val, String name,
            XmlSerializer out) throws XmlPullParserException,
            java.io.IOException 

Method Source Code

//package com.java2s;

import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;

public class Main {
    public static final void writeIntArrayXml(int[] val, String name,
            XmlSerializer out) throws XmlPullParserException,
            java.io.IOException {

        if (val == null) {
            out.startTag(null, "null");
            out.endTag(null, "null");
            return;
        }/*from   ww w .j  av a2  s.c  om*/

        out.startTag(null, "int-array");
        if (name != null) {
            out.attribute(null, "name", name);
        }

        final int N = val.length;
        out.attribute(null, "num", Integer.toString(N));

        for (int i = 0; i < N; i++) {
            out.startTag(null, "item");
            out.attribute(null, "value", Integer.toString(val[i]));
            out.endTag(null, "item");
        }

        out.endTag(null, "int-array");
    }
}

Related

  1. writeDoubleArrayXml(double[] val, String name, XmlSerializer out)
  2. writeDoubleArrayXml(double[] val, String name, XmlSerializer out)
  3. writeFloatAttribute(XmlSerializer out, String name, float value)
  4. writeIntArrayXml(int[] val, String name, XmlSerializer out)
  5. writeIntArrayXml(int[] val, String name, XmlSerializer out)
  6. writeIntAttribute(XmlSerializer out, String name, int value)
  7. writeIntAttribute(XmlSerializer out, String name, int value)
  8. writeListXml(List val, String name, XmlSerializer out)
  9. writeListXml(List val, String name, XmlSerializer out)