集册 Java实例教程 xml解码Java Bean

xml解码Java Bean

欢马劈雪     最近更新时间:2020-01-02 10:19:05

433
xml解码Java Bean
/*N o w  J a v a  .   c o m 提供*/

//package com.nowjava;

import java.beans.XMLDecoder;


import java.io.*;


public class Main {


    public static Object xmlDecode(byte[] bytes) {


        Object obj;

        InputStream is = new ByteArrayInputStream(bytes);

        try (XMLDecoder d = new XMLDecoder(is)) {

            obj = d.readObject();//来自 时代Java - nowjava.com

        }

        return obj;

    }


    public static <T>
展开阅读全文