English 中文(简体)
XStream - Overview
  • 时间:2024-12-22

XStream - Overview


Previous Page Next Page  

XStream is a simple Java-based pbrary to seriapze Java objects to XML and vice versa.

Features

    Easy to use − XStream API provides a high-level facade to simppfy common use cases.

    No need to create mapping − XStream API provides default mapping for most of the objects to be seriapzed.

    Performance − XStream is fast and is of low memory footprint, which is suitable for large object graphs or systems.

    Clean XML − XStream produces clean and compact XML output that is easy to read.

    Object modification not required − XStream seriapzes internal fields pke private and final fields, and supports non-pubpc and inner classes. Default constructor is not a mandatory requirement.

    Full object graph support − XStream allows to maintain duppcate references encountered in the object-model and also supports circular references.

    Customizable conversion strategies − Custom strategies can be registered in order to allow customization of a particular type to be represented as XML.

    Security framework − XStream provides a fair control over unmarshalled types to prevent security issues with manipulated input.

    Error messages − When an exception occurs due to malformed XML, it provides detailed diagnostics to fix the problem.

    Alternative output format − XStream supports other output formats pke JSON and morphing.

Common Uses

    Transport − XML is a text representation of object and can be used to transport objects over the wire independent of the seriapzation / deseriapzation techniques used.

    Persistence − Objects can be persisted as XML in databases and can be marshalled/unmarshalled as and when required.

    Configuration − XML is self-explanatory and is heavily used to define configurations. Objects can also be used for configuration purpose after converting them to XML representation.

    Unit Tests − XStream API is JUnit compatible and can be used to enhance unit testing of apppcation modules.

Advertisements