Package io.protostuff
Class XmlIOUtil
java.lang.Object
io.protostuff.XmlIOUtil
Utility for the XML serialization/deserialization of messages and objects tied to a schema.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom
(byte[] data, int offset, int len, T message, Schema<T> schema, XMLInputFactory inFactory) Merges themessage
with the byte array using the givenschema
.static <T> void
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom
(InputStream in, T message, Schema<T> schema) static <T> void
mergeFrom
(InputStream in, T message, Schema<T> schema, XMLInputFactory inFactory) static <T> void
static <T> void
mergeFrom
(Reader r, T message, Schema<T> schema, XMLInputFactory inFactory) static <T> void
mergeFrom
(XMLStreamReader parser, T message, Schema<T> schema) static Pipe
newPipe
(byte[] data) Creates an xml pipe from a byte array.static Pipe
newPipe
(byte[] data, int offset, int length) Creates an xml pipe from a byte array.static Pipe
newPipe
(InputStream in) Creates an xml pipe from anInputStream
.static Pipe
Creates an xml pipe from aReader
.static Pipe
newPipe
(XMLStreamReader parser) Creates an xml pipe from anXMLStreamReader
.static <T> List
<T> parseListFrom
(InputStream in, Schema<T> schema) static <T> List
<T> parseListFrom
(InputStream in, Schema<T> schema, XMLInputFactory inFactory) static <T> List
<T> parseListFrom
(XMLStreamReader parser, Schema<T> schema) static <T> byte[]
toByteArray
(T message, Schema<T> schema) Serializes themessage
into a byte array.static <T> byte[]
toByteArray
(T message, Schema<T> schema, XMLOutputFactory outFactory) Serializes themessage
into a byte array.static <T> void
writeListTo
(OutputStream out, List<T> messages, Schema<T> schema) Serializes themessages
into theOutputStream
using the given schema.static <T> void
writeListTo
(OutputStream out, List<T> messages, Schema<T> schema, XMLOutputFactory outFactory) Serializes themessages
into theOutputStream
using the given schema.static <T> void
writeListTo
(XMLStreamWriter writer, List<T> messages, Schema<T> schema) Serializes themessages
into theXMLStreamWriter
using the given schema.static <T> void
writeTo
(OutputStream out, T message, Schema<T> schema) static <T> void
writeTo
(OutputStream out, T message, Schema<T> schema, XMLOutputFactory outFactory) static <T> void
static <T> void
writeTo
(Writer w, T message, Schema<T> schema, XMLOutputFactory outFactory) static <T> void
writeTo
(XMLStreamWriter writer, T message, Schema<T> schema)
-
Field Details
-
XML_ENCODING
- See Also:
-
XML_VERSION
- See Also:
-
-
Constructor Details
-
XmlIOUtil
private XmlIOUtil()
-
-
Method Details
-
newPipe
Creates an xml pipe from a byte array.- Throws:
IOException
-
newPipe
Creates an xml pipe from a byte array.- Throws:
IOException
-
newPipe
Creates an xml pipe from anInputStream
.- Throws:
IOException
-
newPipe
Creates an xml pipe from aReader
.- Throws:
IOException
-
newPipe
Creates an xml pipe from anXMLStreamReader
. -
mergeFrom
Merges themessage
with the byte array using the givenschema
. -
mergeFrom
Merges themessage
with the byte array using the givenschema
. -
mergeFrom
public static <T> void mergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema, XMLInputFactory inFactory) Merges themessage
with the byte array using the givenschema
. -
mergeFrom
- Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(InputStream in, T message, Schema<T> schema, XMLInputFactory inFactory) throws IOException - Throws:
IOException
-
mergeFrom
- Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(Reader r, T message, Schema<T> schema, XMLInputFactory inFactory) throws IOException - Throws:
IOException
-
mergeFrom
public static <T> void mergeFrom(XMLStreamReader parser, T message, Schema<T> schema) throws IOException, XMLStreamException, XmlInputException -
toByteArray
Serializes themessage
into a byte array. -
toByteArray
Serializes themessage
into a byte array. -
writeTo
- Throws:
IOException
-
writeTo
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, XMLOutputFactory outFactory) throws IOException - Throws:
IOException
-
writeTo
- Throws:
IOException
-
writeTo
public static <T> void writeTo(Writer w, T message, Schema<T> schema, XMLOutputFactory outFactory) throws IOException - Throws:
IOException
-
writeTo
public static <T> void writeTo(XMLStreamWriter writer, T message, Schema<T> schema) throws IOException, XMLStreamException, XmlOutputException -
writeListTo
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema) throws IOException Serializes themessages
into theOutputStream
using the given schema.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, XMLOutputFactory outFactory) throws IOException Serializes themessages
into theOutputStream
using the given schema.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(XMLStreamWriter writer, List<T> messages, Schema<T> schema) throws IOException, XMLStreamException Serializes themessages
into theXMLStreamWriter
using the given schema.- Throws:
IOException
XMLStreamException
-
parseListFrom
- Throws:
IOException
-
parseListFrom
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, XMLInputFactory inFactory) throws IOException - Throws:
IOException
-
parseListFrom
public static <T> List<T> parseListFrom(XMLStreamReader parser, Schema<T> schema) throws IOException, XMLStreamException - Throws:
IOException
XMLStreamException
-