JKObjectUtil.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:jk-util 作者:
/**
 * To xml.
 *
 * @param obj
 *            the obj
 * @return the string
 */
// ////////////////////////////////////////////////////////////////////
public static String toXml(final Object obj) {
    final ByteArrayOutputStream out = new ByteArrayOutputStream();

    // XStream x = createXStream();
    // String xml = x.toXML(obj);
    // return xml;
    final XMLEncoder e = new XMLEncoder(out);
    e.setExceptionListener(new XmlEncoderExceptionListener());
    // e.setPersistenceDelegate(Object.class, new MyPersistenceDelegate());
    e.writeObject(obj);
    e.close();
    return out.toString();
    // return null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号