org.omnaest.utils.xml
Class XMLHelper

java.lang.Object
  extended by org.omnaest.utils.xml.XMLHelper

public class XMLHelper
extends Object

Helper class for JAXB annotated classes.

Author:
Omnaest

Field Summary
static String ENCODING_UTF_8
           
 
Constructor Summary
XMLHelper()
           
 
Method Summary
static
<E> E
cloneObject(E object)
           
static
<E> E
loadObjectFromXML(CharSequence charSequence, Class<E> typeClazz)
           
static
<E> E
loadObjectFromXML(InputStream inputStream, Class<E> typeClazz)
          Loads an object from the given class type from an InputStream.
static
<E> E
loadObjectFromXML(String xmlContent, Class<E> typeClazz)
           
static String storeObjectAsXML(Object object)
          Stores the given object as XML String using the ENCODING_UTF_8
static void storeObjectAsXML(Object object, Appendable appendable)
          Stores the given objects as XML within the given Appendable using the ENCODING_UTF_8
static void storeObjectAsXML(Object object, Appendable appendable, String encoding)
          Stores the given object as XML within the given Appendable using the given encoding.
static void storeObjectAsXML(Object object, OutputStream outputStream)
          Stores a given JAXB annotated object to the given OutputStream using the ENCODING_UTF_8
static void storeObjectAsXML(Object object, OutputStream outputStream, String encoding)
          Stores a given JAXB annotated object to the given OutputStream using the given character encoding
static String storeObjectAsXML(Object object, String encoding)
          Stores the given object as XML String using the given encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_UTF_8

public static final String ENCODING_UTF_8
See Also:
Constant Field Values
Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

storeObjectAsXML

public static void storeObjectAsXML(Object object,
                                    OutputStream outputStream)
Stores a given JAXB annotated object to the given OutputStream using the ENCODING_UTF_8

Parameters:
object -
outputStream -
See Also:
storeObjectAsXML(Object, OutputStream, String)

storeObjectAsXML

public static void storeObjectAsXML(Object object,
                                    OutputStream outputStream,
                                    String encoding)
Stores a given JAXB annotated object to the given OutputStream using the given character encoding

Parameters:
object -
outputStream -
encoding -
See Also:
storeObjectAsXML(Object, OutputStream)

storeObjectAsXML

public static void storeObjectAsXML(Object object,
                                    Appendable appendable)
Stores the given objects as XML within the given Appendable using the ENCODING_UTF_8

Parameters:
object -
appendable -

storeObjectAsXML

public static void storeObjectAsXML(Object object,
                                    Appendable appendable,
                                    String encoding)
Stores the given object as XML within the given Appendable using the given encoding. E.g as Appendable a StringBuilder or StringBuffer can be used.

Parameters:
object -
appendable -
encoding -

storeObjectAsXML

public static String storeObjectAsXML(Object object)
Stores the given object as XML String using the ENCODING_UTF_8

Parameters:
object -
Returns:
See Also:
storeObjectAsXML(Object, String)

storeObjectAsXML

public static String storeObjectAsXML(Object object,
                                      String encoding)
Stores the given object as XML String using the given encoding.

Parameters:
object -
encoding -
Returns:
See Also:
storeObjectAsXML(Object, OutputStream), storeObjectAsXML(Object)

loadObjectFromXML

public static <E> E loadObjectFromXML(InputStream inputStream,
                                      Class<E> typeClazz)
Loads an object from the given class type from an InputStream. The class has to have JAXB annotations.

Type Parameters:
E -
Parameters:
inputStream -
typeClazz -
Returns:

loadObjectFromXML

public static <E> E loadObjectFromXML(CharSequence charSequence,
                                      Class<E> typeClazz)

loadObjectFromXML

public static <E> E loadObjectFromXML(String xmlContent,
                                      Class<E> typeClazz)

cloneObject

public static <E> E cloneObject(E object)


Copyright © 2011. All Rights Reserved.