精华内容
下载资源
问答
  • XStream
    千次阅读
    2021-03-14 12:02:15

    xStream框架

    xStream可以轻易的将Java对象和xml文档相互转换,而且可以修改某个特定的属性和节点名称,而且也支持json的转换;

    它们都完美支持JSON,但是对xml的支持还不是很好。一定程度上限制了对Java对象的描述,不能让xml完全体现到对Java对象的描述。这里将会介绍xStream对JSON、XML的完美支持。xStream不仅对XML的转换非常友好,而且提供annotation注解,可以在JavaBean中完成对xml节点、属性的描述。以及对JSON也支持,只需要提供相关的JSONDriver就可以完成转换。

    一、准备工作

    1、 下载jar包、及官方资源

    xStream的jar下载地址:

    添加xstream-1.3.1.jar文件到工程中,就可以开始下面的工作;需要的jar如下:

    28276322_1.jpg

    2、 测试用例代码

    package com.hoo.test;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.StringReader;import java.io.Writer;import java.util.ArrayList;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.Set;import org.codehaus.jettison.json.JSONException;import org.junit.After;import org.junit.Before;import org.junit.Test;import com.hoo.entity.Birthday;import com.hoo.entity.Classes;import com.hoo.entity.ListBean;import com.hoo.entity.Student;import com.thoughtworks.xstream.XStream;import com.thoughtworks.xstream.io.HierarchicalStreamWriter;import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver;import com.thoughtworks.xstream.io.json.JsonWriter;/*** function:Java对象和XML字符串的相互转换* jar-lib-version: xstream-1.3.1* @author hoojo* @createDate Nov 27, 2010 12:15:15 PM* @file XStreamTest.java* @package com.hoo.test* @project WebHttpUtils* @blog http://blog.csdn.net/IBM_hoojo* @email hoojo_@126.com* @version 1.0*/@SuppressWarnings("unchecked")public class XStreamTest {private XStream xstream = null;private ObjectOutputStream out = null;private ObjectInputStream in = null;private Student bean = null;/*** function:初始化资源准备* @author hoojo* @createDate Nov 27, 2010 12:16:28 PM*/@Beforepublic void init() {try {xstream = new XStream();//xstream = new XStream(new DomDriver()); // 需要xpp3 jar} catch (Exception e) {e.printStackTrace();}bean = new Student();bean.setAddress("china");bean.setEmail("jack@email.com");bean.setId(1);bean.setName("jack");Birthday day = new Birthday();day.setBirthday("2010-11-22");bean.setBirthday(day);}/*** function:释放对象资源* @author hoojo* @createDate Nov 27, 2010 12:16:38 PM*/@Afterpublic void destory() {xstream = null;bean = null;try {if (out != null) {out.flush();out.close();}if (in != null) {in.close();}} catch (IOException e) {e.printStackTrace();}System.gc();}public final void fail(String string) {System.out.println(string);}public final void failRed(String string) {System.err.println(string);}}

    通过XStream对象的toXML方法就可以完成Java对象到XML的转换,toXML方法还有2个相同签名的方法,需要传递一个流。然后通过流来完成xml信息的输出。

    3、 需要的JavaBean

    package com.hoo.entity;public class Student {private int id;private String name;private String email;private String address;private Birthday birthday;//getter、setterpublic String toString() {return this.name + "#" + this.id + "#" + this.address + "#" + this.birthday + "#" + this.email;}}

    二、Java转换成XML

    1、 JavaBean转换XM

    /*** function:Java对象转换成XML字符串* @author hoojo* @createDate Nov 27, 2010 12:19:01 PM*/@Testpublic void writeBean2XML() {try {fail("------------Bean->XML------------");fail(xstream.toXML(bean));fail("重命名后的XML");//类重命名//xstream.alias("account", Student.class);//xstream.alias("生日", Birthday.class);//xstream.aliasField("生日", Student.class, "birthday");//xstream.aliasField("生日", Birthday.class, "birthday");//fail(xstream.toXML(bean));//属性重命名xstream.aliasField("邮件", Student.class, "email");//包重命名xstream.aliasPackage("hoo", "com.hoo.entity");fail(xstream.toXML(bean));} catch (Exception e) {e.printStackTrace();}}

    看结果中的第一份xml内容,是没有经过然后修改或重命名的文档,按照原样输出。文档中的第二份文档的package经过重命名,email属性也经过重命名以及类名也可以进行重命名的。

    运行后结果如下:

    ------------Bean->XML------------1jackjack@email.com

    china
    2010-11-22重命名后的XML1jackjack@email.com邮件>
    china
    2010-11-22

    2、 将List集合转换成xml文档

    /*** function:将Java的List集合转换成XML对象* @author hoojo* @createDate Nov 27, 2010 12:20:07 PM*/@Testpublic void writeList2XML() {try {//修改元素名称xstream.alias("beans", ListBean.class);xstream.alias("student", Student.class);fail("----------List-->XML----------");ListBean listBean = new ListBean();listBean.setName("this is a List Collection");List list = new ArrayList();list.add(bean);list.add(bean);//引用bean//list.add(listBean);//引用listBean,父元素bean = new Student();bean.setAddress("china");bean.setEmail("tom@125.com");bean.setId(2);bean.setName("tom");Birthday day = new Birthday("2010-11-22");bean.setBirthday(day);list.add(bean);listBean.setList(list);//将ListBean中的集合设置空元素,即不显示集合元素标签//xstream.addImplicitCollection(ListBean.class, "list");//设置reference模型//xstream.setMode(XStream.NO_REFERENCES);//不引用xstream.setMode(XStream.ID_REFERENCES);//id引用//xstream.setMode(XStream.XPATH_ABSOLUTE_REFERENCES);//绝对路径引用//将name设置为父类(Student)的元素的属性xstream.useAttributeFor(Student.class, "name");xstream.useAttributeFor(Birthday.class, "birthday");//修改属性的namexstream.aliasAttribute("姓名", "name");xstream.aliasField("生日", Birthday.class, "birthday");fail(xstream.toXML(listBean));} catch (Exception e) {e.printStackTrace();}}

    上面的代码运行后,结果如下:

    ----------List-->XML----------this is a List Collection1jack@email.com

    china
    2tom@125.com
    china

    如果不加xstream.addImplicitCollection(ListBean.class, "list");

    这个设置的话,会出现一个List节点包裹着Student节点元素。添加addImplicitCollection可以忽略这个list节点元素。那么上面的list节点就不存在,只会在beans元素中出现name、student这2个xml元素标签;

    setMode是设置相同的对象的引用方式,如果设置XStream.NO_REFERENCES就是不引用,会输出2分相同的Student元素。如果是XStream.ID_REFERENCES会引用相同的那个对象的id属性,如果是XStream.XPATH_ABSOLUTE_REFERENCES引用,那么它将显示xpath路径。上面采用的id引用,这个引用了id=3的那个student标签元素;

    useAttributeFor是设置某个节点显示到父节点的属性中,也就是将指定class中的指定属性,在这个class元素节点的属性中显示。

    如:hoojo

    设置好后就是这样的结果:

    aliasAttribute是修改属性名称。

    3、 在JavaBean中添加Annotation注解进行重命名设置

    先看看JavaBean的代码

    package com.hoo.entity;import java.util.Arrays;import java.util.Calendar;import java.util.GregorianCalendar;import java.util.List;import com.thoughtworks.xstream.annotations.XStreamAlias;import com.thoughtworks.xstream.annotations.XStreamAsAttribute;import com.thoughtworks.xstream.annotations.XStreamConverter;import com.thoughtworks.xstream.annotations.XStreamImplicit;import com.thoughtworks.xstream.annotations.XStreamOmitField;@XStreamAlias("class")public class Classes {/** 设置属性显示*/@XStreamAsAttribute@XStreamAlias("名称")private String name;/** 忽略*/@XStreamOmitFieldprivate int number;@XStreamImplicit(itemFieldName = "Students")private List students;@SuppressWarnings("unused")@XStreamConverter(SingleValueCalendarConverter.class)private Calendar created = new GregorianCalendar();public Classes(){}public Classes(String name, Student... stu) {this.name = name;this.students = Arrays.asList(stu);}//getter、setter}

    SingleValueCalendarConverter.java这个是一个类型转换器

    package com.hoo.entity;import java.util.Calendar;import java.util.Date;import java.util.GregorianCalendar;import com.thoughtworks.xstream.converters.Converter;import com.thoughtworks.xstream.converters.MarshallingContext;import com.thoughtworks.xstream.converters.UnmarshallingContext;import com.thoughtworks.xstream.io.HierarchicalStreamReader;import com.thoughtworks.xstream.io.HierarchicalStreamWriter;public class SingleValueCalendarConverter implements Converter {public void marshal(Object source, HierarchicalStreamWriter writer,MarshallingContext context) {Calendar calendar = (Calendar) source;writer.setValue(String.valueOf(calendar.getTime().getTime()));}public Object unmarshal(HierarchicalStreamReader reader,UnmarshallingContext context) {GregorianCalendar calendar = new GregorianCalendar();calendar.setTime(new Date(Long.parseLong(reader.getValue())));return calendar;}@SuppressWarnings("unchecked")public boolean canConvert(Class type) {return type.equals(GregorianCalendar.class);}}

    再看看测试用例代码

    @Testpublic void writeList2XML4Annotation() {try {failRed("---------annotation Bean --> XML---------");Student stu = new Student();stu.setName("jack");Classes c = new Classes("一班", bean, stu);c.setNumber(2);//对指定的类使用Annotation//xstream.processAnnotations(Classes.class);//启用Annotation//xstream.autodetectAnnotations(true);xstream.alias("student", Student.class);fail(xstream.toXML(c));} catch (Exception e) {e.printStackTrace();}}

    当启用annotation或是对某个特定的类启用annotation时,上面的classes这个类才有效果。如果不启用annotation,运行后结果如下:

    ---------annotation Bean --> XML---------一班21jackjack@email.com

    china
    2010-11-220jack1303292056718Asia/Shanghai

    当启用annotation后xstream.processAnnotations(Classes.class),结果如下:

    ---------annotation Bean --> XML---------1jackjack@email.com

    china
    2010-11-220jack1303292242937

    4、 Map集合转换xml文档

    /*** function:Java Map集合转XML* @author hoojo* @createDate Nov 27, 2010 1:13:26 PM*/@Testpublic void writeMap2XML() {try {failRed("---------Map --> XML---------");Map map = new HashMap();map.put("No.1", bean);//putbean = new Student();bean.setAddress("china");bean.setEmail("tom@125.com");bean.setId(2);bean.setName("tom");Birthday day = new Birthday("2010-11-22");bean.setBirthday(day);map.put("No.2", bean);//putbean = new Student();bean.setName("jack");map.put("No.3", bean);//putxstream.alias("student", Student.class);xstream.alias("key", String.class);xstream.useAttributeFor(Student.class, "id");xstream.useAttributeFor("birthday", String.class);fail(xstream.toXML(map));} catch (Exception e) {e.printStackTrace();}}

    运行后结果如下:

    ---------Map --> XML---------No.3jackNo.1jackjack@email.com

    china
    No.2tomtom@125.com
    china

    5、 用OutStream输出流写XML

    /*** function:用OutStream输出流写XML* @author hoojo* @createDate Nov 27, 2010 1:13:48 PM*/@Testpublic void writeXML4OutStream() {try {out = xstream.createObjectOutputStream(System.out);Student stu = new Student();stu.setName("jack");Classes c = new Classes("一班", bean, stu);c.setNumber(2);failRed("---------ObjectOutputStream # JavaObject--> XML---------");out.writeObject(stu);out.writeObject(new Birthday("2010-05-33"));out.write(22);//byteout.writeBoolean(true);out.writeFloat(22.f);out.writeUTF("hello");} catch (Exception e) {e.printStackTrace();}}

    使用输出流后,可以通过流对象完成xml的构建,即使没有JavaBean对象,你可以用流来构建一个复杂的xml文档,运行后结果如下:

    ---------ObjectOutputStream # JavaObject--> XML---------0jack2010-05-3322true22.0hello

    三、XML内容转换Java对象

    1、 用InputStream将XML文档转换成java对象

    /*** function:用InputStream将XML文档转换成java对象* 需要额外的jar xpp3-main.jar* @author hoojo* @createDate Nov 27, 2010 1:14:52 PM*/@Testpublic void readXML4InputStream() {try {String s = "0jack" +"2010-05-33" +"22true22.0" +"hello";failRed("---------ObjectInputStream## XML --> javaObject---------");StringReader reader = new StringReader(s);in = xstream.createObjectInputStream(reader);Student stu = (Student) in.readObject();Birthday b = (Birthday) in.readObject();byte i = in.readByte();boolean bo = in.readBoolean();float f = in.readFloat();String str = in.readUTF();System.out.println(stu);System.out.println(b);System.out.println(i);System.out.println(bo);System.out.println(f);System.out.println(str);} catch (Exception e) {e.printStackTrace();}}

    读取后,转换的Java对象,结果如下:

    ---------ObjectInputStream## XML --> javaObject---------jack#0#null#null#null2010-05-3322true22.0hello

    2、 将xml文档转换成Java对象

    /*** function:将XML字符串转换成Java对象* @author hoojo* @createDate Nov 27, 2010 2:39:06 PM*/@Testpublic void readXml2Object() {try {failRed("-----------Xml >>> Bean--------------");Student stu = (Student) xstream.fromXML(xstream.toXML(bean));fail(stu.toString());List list = new ArrayList();list.add(bean);//addMap map = new HashMap();map.put("No.1", bean);//putbean = new Student();bean.setAddress("china");bean.setEmail("tom@125.com");bean.setId(2);bean.setName("tom");Birthday day = new Birthday("2010-11-22");bean.setBirthday(day);list.add(bean);//addmap.put("No.2", bean);//putbean = new Student();bean.setName("jack");list.add(bean);//addmap.put("No.3", bean);//putfailRed("==========XML >>> List===========");List studetns = (List) xstream.fromXML(xstream.toXML(list));fail("size:" + studetns.size());//3for (Student s : studetns) {fail(s.toString());}failRed("==========XML >>> Map===========");Map maps = (Map) xstream.fromXML(xstream.toXML(map));fail("size:" + maps.size());//3Set key = maps.keySet();Iterator iter = key.iterator();while (iter.hasNext()) {String k = iter.next();fail(k + ":" + map.get(k));}} catch (Exception e) {e.printStackTrace();}}

    运行后结果如下:

    -----------Xml >>> Bean--------------jack#1#china#2010-11-22#jack@email.com==========XML >>> List===========size:3jack#1#china#2010-11-22#jack@email.comtom#2#china#2010-11-22#tom@125.comjack#0#null#null#null==========XML >>> Map===========size:3No.3:jack#0#null#null#nullNo.1:jack#1#china#2010-11-22#jack@email.comNo.2:tom#2#china#2010-11-22#tom@125.com

    怎么样,成功的完成XML到JavaBean、List、Map的转换,更多对象转换还需要大家一一尝试。用法类似~这里就不一样赘述。

    四、XStream对JSON的支持

    xStream对JSON也有非常好的支持,它提供了2个模型驱动。用这2个驱动可以完成Java对象到JSON的相互转换。使用JettisonMappedXmlDriver驱动,将Java对象转换成json,需要添加jettison.jar

    1、 用JettisonMappedXmlDriver完成Java对象到JSON的转换

    /*** function:XStream结合JettisonMappedXmlDriver驱动,转换Java对象到JSON* 需要添加jettison jar* @author hoojo* @createDate Nov 27, 2010 1:23:18 PM*/@Testpublic void writeEntity2JETTSON() {failRed("=======JettisonMappedXmlDriver===JavaObject >>>> JaonString=========");xstream = new XStream(new JettisonMappedXmlDriver());xstream.setMode(XStream.NO_REFERENCES);xstream.alias("student", Student.class);fail(xstream.toXML(bean));}

    运行后结果如下:

    =======JettisonMappedXmlDriver===JavaObject >>>> JaonString========={"student":{"id":1,"name":"jack","email":"jack@email.com","address":"china","birthday":[{},"2010-11-22"]}}

    JSON的转换和XML的转换用法一样,只是创建XStream需要传递一个参数,这个参数就是xml到JSON映射转换的驱动。这里会降到两个驱动,分别是JettisonMappedXmlDriver、JsonHierarchicalStreamDriver。

    2、 JsonHierarchicalStreamDriver完成Java对象到JSON的转换

    /*** function:用XStream结合JsonHierarchicalStreamDriver驱动* 转换java对象为JSON字符串* @author hoojo* @createDate Nov 27, 2010 1:16:46 PM*/@Testpublic void writeEntiry2JSON() {failRed("======JsonHierarchicalStreamDriver====JavaObject >>>> JaonString=========");xstream = new XStream(new JsonHierarchicalStreamDriver());//xstream.setMode(XStream.NO_REFERENCES);xstream.alias("student", Student.class);failRed("-------Object >>>> JSON---------");fail(xstream.toXML(bean));//failRed("========JsonHierarchicalStreamDriver==删除根节点=========");//删除根节点xstream = new XStream(new JsonHierarchicalStreamDriver() {public HierarchicalStreamWriter createWriter(Writer out) {return new JsonWriter(out, JsonWriter.DROP_ROOT_MODE);}});//xstream.setMode(XStream.NO_REFERENCES);xstream.alias("student", Student.class);fail(xstream.toXML(bean));}

    运行后结果如下:

    ======JsonHierarchicalStreamDriver====JavaObject >>>> JaonString=========-------Object >>>> JSON---------{"student": {"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}}}{"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}}

    使用JsonHierarchicalStreamDriver转换默认会给转换后的对象添加一个根节点,但是在构建JsonHierarchicalStreamDriver驱动的时候,你可以重写createWriter方法,删掉根节点。

    看上面的结果,一个是默认带根节点的JSON对象,它只是将类名作为一个属性,将对象作为该属性的一个值。而另一个没有带根属性的JSON就是通过重写createWriter方法完成的。

    3、 将List集合转换成JSON字符串

    @Testpublic void writeList2JSON() {failRed("======JsonHierarchicalStreamDriver====JavaObject >>>> JaonString=========");JsonHierarchicalStreamDriver driver = new JsonHierarchicalStreamDriver();xstream = new XStream(driver);//xstream = new XStream(new JettisonMappedXmlDriver());//转换错误//xstream.setMode(XStream.NO_REFERENCES);xstream.alias("student", Student.class);List list = new ArrayList();list.add(bean);//addbean = new Student();bean.setAddress("china");bean.setEmail("tom@125.com");bean.setId(2);bean.setName("tom");Birthday day = new Birthday("2010-11-22");bean.setBirthday(day);list.add(bean);//addbean = new Student();bean.setName("jack");list.add(bean);//addfail(xstream.toXML(list));//failRed("========JsonHierarchicalStreamDriver==删除根节点=========");//删除根节点xstream = new XStream(new JsonHierarchicalStreamDriver() {public HierarchicalStreamWriter createWriter(Writer out) {return new JsonWriter(out, JsonWriter.DROP_ROOT_MODE);}});xstream.alias("student", Student.class);fail(xstream.toXML(list));}

    运行后结果如下

    ======JsonHierarchicalStreamDriver====JavaObject >>>> JaonString=========##{"list": [{"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}},{"id": 2,"name": "tom","email": "tom@125.com","address": "china","birthday": {"birthday": "2010-11-22"}},{"id": 0,"name": "jack"}]}#[{"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}},{"id": 2,"name": "tom","email": "tom@125.com","address": "china","birthday": {"birthday": "2010-11-22"}},{"id": 0,"name": "jack"}]

    上面的list1是使用JsonHierarchicalStreamDriver 转换的,当然你也可以使用JettisonMappedXmlDriver驱动进行转换;用JettisonMappedXmlDriver转换后,你会发现格式不同而且没有根属性。

    4、 Map转换json

    @Testpublic void writeMap2JSON() {failRed("======JsonHierarchicalStreamDriver==== Map >>>> JaonString=========");xstream = new XStream(new JsonHierarchicalStreamDriver());//xstream = new XStream(new JettisonMappedXmlDriver());xstream.alias("student", Student.class);Map map = new HashMap();map.put("No.1", bean);//putbean = new Student();bean.setAddress("china");bean.setEmail("tom@125.com");bean.setId(2);bean.setName("tom");bean.setBirthday(new Birthday("2010-11-21"));map.put("No.2", bean);//putbean = new Student();bean.setName("jack");map.put("No.3", bean);//putfail(xstream.toXML(map));//failRed("========JsonHierarchicalStreamDriver==删除根节点=========");//删除根节点xstream = new XStream(new JsonHierarchicalStreamDriver() {public HierarchicalStreamWriter createWriter(Writer out) {return new JsonWriter(out, JsonWriter.DROP_ROOT_MODE);}});xstream.alias("student", Student.class);fail(xstream.toXML(map));}

    运行后结果如下:

    ======JsonHierarchicalStreamDriver==== Map >>>> JaonString========={"map": [["No.3",{"id": 0,"name": "jack"}],["No.1",{"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}}],["No.2",{"id": 2,"name": "tom","email": "tom@125.com","address": "china","birthday": {"birthday": "2010-11-21"}}]]}[["No.3",{"id": 0,"name": "jack"}],["No.1",{"id": 1,"name": "jack","email": "jack@email.com","address": "china","birthday": {"birthday": "2010-11-22"}}],["No.2",{"id": 2,"name": "tom","email": "tom@125.com","address": "china","birthday": {"birthday": "2010-11-21"}}]]

    5、 将JSON转换java对象

    /*** function:JsonHierarchicalStreamDriver可以将简单的json字符串转换成java对象,list、map转换不成功;* JsonHierarchicalStreamDriver读取JSON字符串到java对象出错* @author hoojo* @createDate Nov 27, 2010 1:22:26 PM* @throws JSONException*/@Testpublic void readJSON2Object() throws JSONException {String json = "{\"student\": {" +"\"id\": 1," +"\"name\": \"haha\"," +"\"email\": \"email\"," +"\"address\": \"address\"," +"\"birthday\": {" +"\"birthday\": \"2010-11-22\"" +"}" +"}}";//JsonHierarchicalStreamDriver读取JSON字符串到java对象出错,但JettisonMappedXmlDriver可以xstream = new XStream(new JettisonMappedXmlDriver());xstream.alias("student", Student.class);fail(xstream.fromXML(json).toString());//JettisonMappedXmlDriver转换List集合出错,但JsonHierarchicalStreamDriver可以转换正确//JettisonMappedXmlDriver 转换的字符串 {"list":{"student":[{"id":1,"name":"haha","email":"email","address":"address","birthday":[{},"2010-11-22"]}]},"student":{"id":2,"name":"tom","email":"tom@125.com","address":"china","birthday":[{},"2010-11-22"]}}json = "{\"list\": [{" +"\"id\": 1," +"\"name\": \"haha\"," +"\"email\": \"email\"," +"\"address\": \"address\"," +"\"birthday\": {" +"\"birthday\": \"2010-11-22\"" +"}" +"},{" +"\"id\": 2," +"\"name\": \"tom\"," +"\"email\": \"tom@125.com\"," +"\"address\": \"china\"," +"\"birthday\": {" +"\"birthday\": \"2010-11-22\"" +"}" +"}]}";System.out.println(json);//用js转换成功List list = (List) xstream.fromXML(json);System.out.println(list.size());//0好像转换失败}

    运行后结果如下:

    haha#1#address#2010-11-22#email{"list": [{"id": 1,"name": "haha","email": "email","address": "address","birthday": {"birthday": "2010-11-22"}},{"id": 2,"name": "tom","email": "tom@125.com","address": "china","birthday": {"birthday": "2010-11-22"}}]}0

    JSON到Java的转换是fromXML方法。

    更多相关内容
  • xstream最新版jar包
  • xstream-1.4.15.jar

    2021-01-28 10:34:26
    XStream 反序列化漏洞(CVE-2020-26258 & 26259),修复jar包 xstream-1.4.15.jar Xstream 是 Java 类库,用来将对象序列化成 XML (JSON) 或反序列化为对象。XStream 是一款开源软件,允许在 BSD 许可证的许可下分发...
  • xstream-1.4.19.jar

    2022-05-04 21:42:58
    xstream-1.4.19.jar
  • XStream中的核心类就是XStream类,一般来说,熟悉这个类基本就够用了,如果你用的更多,估计是你设计有问题,否则不需要。 XStream对象相当Java对象和XML之间的转换器,转换过程是双向的。创建XSteam对象的方式很...
  • XStream依赖Jar包

    2019-05-21 10:29:19
    XStream依赖Jar包,里面有:xmlpull-1.1.3.1.jar、xpp3_min-1.1.4c.jar、xstream-1.4.4.jar,需要的小伙伴可以来下载!
  • 赠送jar包:xstream-1.4.11.jar; 赠送原API文档:xstream-1.4.11-javadoc.jar; 赠送源代码:xstream-1.4.11-sources.jar; 赠送Maven依赖信息文件:xstream-1.4.11.pom; 包含翻译后的API文档:xstream-1.4.11-...
  • xstream142和xpp3.zip

    2020-06-12 11:46:20
    xstream-1.4.2.jar和xpp3_min-1.1.4c.jar包下载,用于JAVA解析xml,欢迎你的使用,以提升你的开发效率
  • jar包,官方版本,自测可用
  • 最齐全的xstream1.4.8.jar

    2022-05-20 12:06:44
    最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar 最齐全的xstream1.4.8.jar ...
  • xstream-1.4.3.jar.zip

    2020-04-30 15:45:34
    XStream是一个简单的基于Java库,Java对象序列化到XML,反之亦然(即:可以轻易的将Java对象和xml文档相互转换)。
  • xstream-1.4.9-javadoc.jar

    2020-08-11 18:02:06
    xstream最新版本,废了好长时间才找到,如果想要找到更多版本,可以去官网下载,这是最近版本的下载,不嫌弃的话拿去用吧
  • xStream完整Jar包

    2018-12-13 10:08:03
    xStream完整jar包.zip,xStream完整jar包,xmlpull-xpp3-3.0.0.jar,xstream-1.4.7.jar,jaxb-1.18.1.jar
  • xstream-1.4.4-sources.jar

    2019-01-14 16:11:59
    XStream 是一个开源项目,一套简单实用的类库,用于序列化对象与 XML 对象之间的相互转换。将 XML 文件内容解析为一个对象或将一个对象序列化为 XML 文件。
  • xstream-1.4.2.jar和xpp3_min-1.1.4c.jar包下载,用于解析xml,需要的小伙伴欢迎下载。
  • jar包,官方版本,自测可用
  • xstream

    2019-07-30 01:19:33
    xStream.rar,Test3.java
  • xstream-1.4.16.zip

    2021-05-14 11:11:37
    XStream是一个常用的Java对象和XML相互转换的工具。近日XStream官方发布安全更新,修复了XStream 反序列化漏洞(CVE-2020-26258、CVE-2020-26259)。攻击者通过构造恶意的XML文档,可绕过XStream的黑名单,触发反...
  • xstream-1.4.11.1.zip jar包

    2020-02-01 15:14:53
    xstream-1.4.11.1.zip,附软件编程资料.txt,免责声明.txt,xstream-1.4.11.1.jar
  • xstream解析依赖包

    2017-08-18 15:36:15
    xpp3_min-1.1.4c.jar xstream-1.3.1.jar
  • xstream1.4.15.JAR

    2021-02-23 10:20:30
    XStream 反序列化漏洞修复
  • NULL 博文链接:https://liuxihope.iteye.com/blog/2228714
  • xstream-1.4.8最齐全jar包.zip,xstream-1.4.8最齐全jar包,xstream-1.4.8-javadoc.jar,xpp3_min-1.1.4c-sources.jar,xmlpull-1.1.3.1.jar,xstream-1.4.8-sources.jar,xpp3_min-1.1.4c-javadoc.jar,xpp3_min-1.1.4c....
  • xstream-1.3.1.zip

    2020-11-02 15:00:50
    包含xstream-1.3.1.jar一个jar包,可以根据实际需要下载使用。 由于是比较难找的jar,所以上传共享
  • xstream-1.4.8-javadoc.jar

    2019-01-17 18:24:14
    关于xstream的相关jar包,1.4.8的,不太清楚有什么作用
  • xstream-1.4.7.jar及源码;xml-pull-1.3.1.jar工具类,xstream-1.3.jar,XStream是一个Java对象和XML相互转换的工具,很好很强大。提供了所有的基础类型、数组、集合等类型直接转换的支持。 因此XML常用于数据交换...
  • xstream.rar

    2020-03-31 14:20:17
    Java数据转化成xml格式必备的jar包,包括kxml2,xmlpull,xpp3,xstream四个jar包
  • 收集了一些Xstream所依赖的java包,另外,Xstream是一种OXMapping 技术,是用来处理XML文件序列化的框架,在将javaBean序列化,或将XML文件反序列化的时候,不需要其它辅助类和映射文件,使得XML序列化不再繁琐。
  • 解析xml文件需要用到jar包,内容包含xstream_1.4.3及_xstream_1.4.3 -dom4j及其依赖包,需要用到的都含有

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 15,508
精华内容 6,203
关键字:

XStream