Package io.protostuff
Class XmlIOUtil
- java.lang.Object
-
- io.protostuff.XmlIOUtil
-
public final class XmlIOUtil extends java.lang.Object
Utility for the XML serialization/deserialization of messages and objects tied to a schema.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
XML_ENCODING
static java.lang.String
XML_VERSION
-
Constructor Summary
Constructors Modifier Constructor Description private
XmlIOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> void
mergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema)
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom(byte[] data, T message, Schema<T> schema)
Merges themessage
with the byte array using the givenschema
.static <T> void
mergeFrom(java.io.InputStream in, T message, Schema<T> schema)
Merges themessage
from theInputStream
using the givenschema
.static <T> void
mergeFrom(java.io.InputStream in, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)
Merges themessage
from theInputStream
using the givenschema
.static <T> void
mergeFrom(java.io.Reader r, T message, Schema<T> schema)
Merges themessage
from theReader
using the givenschema
.static <T> void
mergeFrom(java.io.Reader r, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)
Merges themessage
from theReader
using the givenschema
.static <T> void
mergeFrom(javax.xml.stream.XMLStreamReader parser, T message, Schema<T> schema)
Merges themessage
from theXMLStreamReader
using the givenschema
.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(java.io.InputStream in)
Creates an xml pipe from anInputStream
.static Pipe
newPipe(java.io.Reader reader)
Creates an xml pipe from aReader
.static Pipe
newPipe(javax.xml.stream.XMLStreamReader parser)
Creates an xml pipe from anXMLStreamReader
.static <T> java.util.List<T>
parseListFrom(java.io.InputStream in, Schema<T> schema)
Parses themessages
from theInputStream
using the givenschema
.static <T> java.util.List<T>
parseListFrom(java.io.InputStream in, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)
Parses themessages
from theInputStream
using the givenschema
.static <T> java.util.List<T>
parseListFrom(javax.xml.stream.XMLStreamReader parser, Schema<T> schema)
Parses themessages
from theXMLStreamReader
using the givenschema
.static <T> byte[]
toByteArray(T message, Schema<T> schema)
Serializes themessage
into a byte array.static <T> byte[]
toByteArray(T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)
Serializes themessage
into a byte array.static <T> void
writeListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema)
Serializes themessages
into theOutputStream
using the given schema.static <T> void
writeListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)
Serializes themessages
into theOutputStream
using the given schema.static <T> void
writeListTo(javax.xml.stream.XMLStreamWriter writer, java.util.List<T> messages, Schema<T> schema)
Serializes themessages
into theXMLStreamWriter
using the given schema.static <T> void
writeTo(java.io.OutputStream out, T message, Schema<T> schema)
Serializes themessage
into anOutputStream
using the givenschema
.static <T> void
writeTo(java.io.OutputStream out, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)
Serializes themessage
into anOutputStream
using the givenschema
.static <T> void
writeTo(java.io.Writer w, T message, Schema<T> schema)
Serializes themessage
into aWriter
using the givenschema
.static <T> void
writeTo(java.io.Writer w, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)
Serializes themessage
into aWriter
using the givenschema
.static <T> void
writeTo(javax.xml.stream.XMLStreamWriter writer, T message, Schema<T> schema)
Serializes themessage
into anXMLStreamWriter
using the givenschema
.
-
-
-
Field Detail
-
XML_ENCODING
public static final java.lang.String XML_ENCODING
- See Also:
- Constant Field Values
-
XML_VERSION
public static final java.lang.String XML_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
newPipe
public static Pipe newPipe(byte[] data) throws java.io.IOException
Creates an xml pipe from a byte array.- Throws:
java.io.IOException
-
newPipe
public static Pipe newPipe(byte[] data, int offset, int length) throws java.io.IOException
Creates an xml pipe from a byte array.- Throws:
java.io.IOException
-
newPipe
public static Pipe newPipe(java.io.InputStream in) throws java.io.IOException
Creates an xml pipe from anInputStream
.- Throws:
java.io.IOException
-
newPipe
public static Pipe newPipe(java.io.Reader reader) throws java.io.IOException
Creates an xml pipe from aReader
.- Throws:
java.io.IOException
-
newPipe
public static Pipe newPipe(javax.xml.stream.XMLStreamReader parser)
Creates an xml pipe from anXMLStreamReader
.
-
mergeFrom
public static <T> void mergeFrom(byte[] data, T message, Schema<T> schema)
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)
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, javax.xml.stream.XMLInputFactory inFactory)
Merges themessage
with the byte array using the givenschema
.
-
mergeFrom
public static <T> void mergeFrom(java.io.InputStream in, T message, Schema<T> schema) throws java.io.IOException
Merges themessage
from theInputStream
using the givenschema
.- Throws:
java.io.IOException
-
mergeFrom
public static <T> void mergeFrom(java.io.InputStream in, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory) throws java.io.IOException
Merges themessage
from theInputStream
using the givenschema
.- Throws:
java.io.IOException
-
mergeFrom
public static <T> void mergeFrom(java.io.Reader r, T message, Schema<T> schema) throws java.io.IOException
Merges themessage
from theReader
using the givenschema
.- Throws:
java.io.IOException
-
mergeFrom
public static <T> void mergeFrom(java.io.Reader r, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory) throws java.io.IOException
Merges themessage
from theReader
using the givenschema
.- Throws:
java.io.IOException
-
mergeFrom
public static <T> void mergeFrom(javax.xml.stream.XMLStreamReader parser, T message, Schema<T> schema) throws java.io.IOException, javax.xml.stream.XMLStreamException, XmlInputException
Merges themessage
from theXMLStreamReader
using the givenschema
.- Throws:
java.io.IOException
javax.xml.stream.XMLStreamException
XmlInputException
-
toByteArray
public static <T> byte[] toByteArray(T message, Schema<T> schema)
Serializes themessage
into a byte array.
-
toByteArray
public static <T> byte[] toByteArray(T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)
Serializes themessage
into a byte array.
-
writeTo
public static <T> void writeTo(java.io.OutputStream out, T message, Schema<T> schema) throws java.io.IOException
Serializes themessage
into anOutputStream
using the givenschema
.- Throws:
java.io.IOException
-
writeTo
public static <T> void writeTo(java.io.OutputStream out, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory) throws java.io.IOException
Serializes themessage
into anOutputStream
using the givenschema
.- Throws:
java.io.IOException
-
writeTo
public static <T> void writeTo(java.io.Writer w, T message, Schema<T> schema) throws java.io.IOException
Serializes themessage
into aWriter
using the givenschema
.- Throws:
java.io.IOException
-
writeTo
public static <T> void writeTo(java.io.Writer w, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory) throws java.io.IOException
Serializes themessage
into aWriter
using the givenschema
.- Throws:
java.io.IOException
-
writeTo
public static <T> void writeTo(javax.xml.stream.XMLStreamWriter writer, T message, Schema<T> schema) throws java.io.IOException, javax.xml.stream.XMLStreamException, XmlOutputException
Serializes themessage
into anXMLStreamWriter
using the givenschema
.- Throws:
java.io.IOException
javax.xml.stream.XMLStreamException
XmlOutputException
-
writeListTo
public static <T> void writeListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema) throws java.io.IOException
Serializes themessages
into theOutputStream
using the given schema.- Throws:
java.io.IOException
-
writeListTo
public static <T> void writeListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory) throws java.io.IOException
Serializes themessages
into theOutputStream
using the given schema.- Throws:
java.io.IOException
-
writeListTo
public static <T> void writeListTo(javax.xml.stream.XMLStreamWriter writer, java.util.List<T> messages, Schema<T> schema) throws java.io.IOException, javax.xml.stream.XMLStreamException
Serializes themessages
into theXMLStreamWriter
using the given schema.- Throws:
java.io.IOException
javax.xml.stream.XMLStreamException
-
parseListFrom
public static <T> java.util.List<T> parseListFrom(java.io.InputStream in, Schema<T> schema) throws java.io.IOException
Parses themessages
from theInputStream
using the givenschema
.- Throws:
java.io.IOException
-
parseListFrom
public static <T> java.util.List<T> parseListFrom(java.io.InputStream in, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory) throws java.io.IOException
Parses themessages
from theInputStream
using the givenschema
.- Throws:
java.io.IOException
-
parseListFrom
public static <T> java.util.List<T> parseListFrom(javax.xml.stream.XMLStreamReader parser, Schema<T> schema) throws java.io.IOException, javax.xml.stream.XMLStreamException
Parses themessages
from theXMLStreamReader
using the givenschema
.- Throws:
java.io.IOException
javax.xml.stream.XMLStreamException
-
-