博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
xStream完美转换XML、JSON
阅读量:5829 次
发布时间:2019-06-18

本文共 2153 字,大约阅读时间需要 7 分钟。

XStream is a simple library to serialize objects to XML and back again.

Features

  • Ease of use. A high level facade is supplied that simplifies common use cases.
  • No mappings required. Most objects can be serialized without need for specifying mappings.
  • Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.
  • Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.
  • Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.
  • Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.
  • Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).
  • Customizable conversion strategies. Strategies can be registered allowing customization of how particular types are represented as XML.
  • Security framework. Fine-control about the unmarshalled types to prevent security issues with manipulated input.
  • Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.
  • Alternative output format. The modular design allows other output formats. XStream ships currently with JSON support and morphing.

Typical Uses

  • Transport
  • Persistence
  • Configuration
  • Unit Tests

Known Limitations

If using the enhanced mode, XStream can re-instantiate classes that do not have a default constructor. However, if using a different JVM like an old JRockit version, a JDK 1.4 or you have restrictions because of a SecurityManager, a default constructor is required.

The enhanced mode is also necessary to restore final fields for any JDK < 1.5. This implies deserialization of instances of an inner class.

Auto-detection of annotations may cause race conditions. Preprocessing annotations is safe though.

 

Tutorials

 

转载地址:http://jzodx.baihongyu.com/

你可能感兴趣的文章
5天赚十亿!纯C/C++打造“西虹市首富”
查看>>
MYSQL利用merge存储引擎来实现分表
查看>>
Eclipse上发布Web Service
查看>>
ATEC倒计时25天|区块链技术如何让进口商品的“前世今生”可见
查看>>
docker实现nginx tocmat的负载均衡
查看>>
JsonPath 使用代码实例
查看>>
Guava-EventBus使用详解
查看>>
Ghost 2.15.0 发布,基于 Markdown 的在线写作平台
查看>>
对于Java的认识
查看>>
React 16 Jest ES6级模拟 - 监视并监视模拟情况
查看>>
天壤智能完成1.8亿元A轮融资,招银国际和高榕资本共同领投
查看>>
田径赛事社群运营商“约跑社”获得150万种子轮融资
查看>>
ATEC倒计时13天|蚂蚁金融科技人工智能技术将普惠金融装进农民口袋(内赠门票)...
查看>>
SEO不只是发发链,那么SEO到底是什么呢?
查看>>
tf.gfile.Exists 与 os.path.exists
查看>>
应用监控利器:Pinpoint 全链路监控部署实践
查看>>
vue-jstree安装使用备忘
查看>>
SQL操作符的优先级引起的(MySQL unknown column in ON clause)
查看>>
美国拟立法禁止非汽车制造商上路测试自动驾驶,Uber们要怒了
查看>>
重磅更新:码云企业版之项目多仓库功能上线!!!
查看>>