TestAttrSer.java :  » XML » jox » com » wutka » jox » test » Java Open Source

Java Open Source » XML » jox 
jox » com » wutka » jox » test » TestAttrSer.java
package com.wutka.jox.test;

import com.wutka.jox.*;
import java.io.*;

public class TestAttrSer
{
    public static void main(String[] args)
    {
        try
        {
            TestBean b = new TestBean();
            b.setFoo(5);
            b.setBar("This is the bar value");
            b.setThingies(new String[] {
                "Moe", "Larry", "Curly", "Shemp", "Curly Joe" });
            TestSubbean sub = new TestSubbean();
            sub.setName("Mark");
            sub.setAge(35);
            b.setSub(sub);

            FileOutputStream fileOut = new FileOutputStream("attrbean.xml");
            JOXBeanOutputStream joxOut = new JOXBeanOutputStream(fileOut,
                true);

            joxOut.writeObject("MarkTest", b);

            joxOut.close();
        }
        catch (Exception exc)
        {
            exc.printStackTrace();
        }
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.