Java examples for Reflection:Java Bean
xml Encode Java Bean
//package com.java2s; import java.beans.XMLEncoder; import java.io.*; public class Main { public static byte[] xmlEncode(Object bean) { ByteArrayOutputStream os = new ByteArrayOutputStream(16384); try (XMLEncoder e = new XMLEncoder(os)) { e.writeObject(bean);// ww w. j a va 2 s . co m } return os.toByteArray(); } }