Package de.gurkenlabs.litiengine.util.io
Class XmlUtilities
java.lang.Object
de.gurkenlabs.litiengine.util.io.XmlUtilities
public final class XmlUtilities
extends java.lang.ObjectMethod Summary
Modifier and Type Method Description static <T> javax.xml.bind.JAXBContextgetContext(java.lang.Class<T> cls)static <T> Tread(java.lang.Class<T> cls, java.net.URL path)static java.io.Filesave(java.lang.Object object, java.lang.String fileName)static java.io.Filesave(java.lang.Object object, java.lang.String fileName, java.lang.String extension)static voidsaveWithCustomIndentation(java.io.ByteArrayInputStream input, java.io.FileOutputStream fos, int indentation)Saves the XML, contained by the specified input with the custom indentation.
Method Details
saveWithCustomIndentation
public static void saveWithCustomIndentation(java.io.ByteArrayInputStream input, java.io.FileOutputStream fos, int indentation)Saves the XML, contained by the specified input with the custom indentation. If the input is the result of jaxb marshalling, make sure to set Marshaller.JAXB_FORMATTED_OUTPUT to false in order for this method to work properly.- Parameters:
input- The input stream that contains the original XML.fos- The output stream that is used to save the XML.indentation- The indentation with which the XML should be saved.
getContext
public static <T> javax.xml.bind.JAXBContext getContext(java.lang.Class<T> cls)read
public static <T> T read(java.lang.Class<T> cls, java.net.URL path) throws javax.xml.bind.JAXBException- Throws:
javax.xml.bind.JAXBException
save
public static java.io.File save(java.lang.Object object, java.lang.String fileName)save
public static java.io.File save(java.lang.Object object, java.lang.String fileName, java.lang.String extension)
