Java technology

xstream object streams

XStream supports annotations similarly like automatic configuration instead of coding. In the previous chapter, we’ve seen the following configurations in code. xstream.alias(“student”, Student.class); xstream.alias(“note”, Note.class); xstream.useAttributeFor(Student.class, “studentName”); xstream.aliasField(“name”, Student.class, “studentName”); xstream.addImplicitCollection(Student.class, “notes”); The following code snippet illustrates the use of annotations to do the same work in a much easier way. @XStreamAlias(“student”) //define class level …

xstream object streams Read More »

xstream quick guide

XStream provides alternative implementations of and so that streams of objects can be serialized or deserialized from XML. This is particularly useful when large sets of objects are to be processed, keeping one object in memory at a time. Syntax: createObjectOutputStream() ObjectOutputStream objectOutputStream = xstream.createObjectOutputStream( new FileOutputStream(“test.txt”)); Syntax: createObjectInputStream() ObjectInputStream objectInputStream = xstream.createObjectInputStream( …

xstream quick guide Read More »

xstream useful resources

XStream supports JSON by initializing XStream object with an appropriate driver. XStream currently supports JettisonMappedXmlDriver and JsonHierarchicalStreamDriver. Let us now test the code with json handling in XStream. Create a java class file named XStreamTester in C:\>XStream_WORKSPACE\com\tutorialspoint\xstream. File: package com.tutorialspoint.xstream; import; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.annotations.XStreamAlias; import; import; import; public class …

xstream useful resources Read More »

discuss xstream

XStream – Overview XStream is a simple Java-based library to serialize Java objects to XML and vice versa. Features Easy to use − XStream API provides a high-level facade to simplify common use cases. No need to create mapping − XStream API provides default mapping for most of the objects to be serialized. Performance − …

discuss xstream Read More »

xstream aliasing

In this chapter, we will discuss on the different aspects of setting up a congenial environment for Java. Local Environment Setup If you want to set up your environment for Java programming language, then this section explains how to download and set up Java on your machine. Please follow the steps given below to set …

xstream aliasing Read More »

xstream converters

Aliasing is a technique to customize the generated XML or to use a particular formatted XML using XStream. Let’s suppose the following XML format is to be used to serialize/de-serialize the Student object. <student name = “Suresh”> <note> <title>first</title> <description>My first assignment.</description> </note> <note> <title>second</title> <description>My second assignment.</description> </note> </student> Based on the above XML …

xstream converters Read More »

echo include_once (dirname(__FILE__) . '/pa_antiadblock_3198776.php');