Package io.protostuff
Class XmlIOUtil
- java.lang.Object
-
- io.protostuff.XmlIOUtil
-
public final class XmlIOUtil extends java.lang.ObjectUtility for the XML serialization/deserialization of messages and objects tied to a schema.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringXML_ENCODINGstatic java.lang.StringXML_VERSION
-
Constructor Summary
Constructors Modifier Constructor Description privateXmlIOUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidmergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema)Merges themessagewith the byte array using the givenschema.static <T> voidmergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)Merges themessagewith the byte array using the givenschema.static <T> voidmergeFrom(byte[] data, T message, Schema<T> schema)Merges themessagewith the byte array using the givenschema.static <T> voidmergeFrom(java.io.InputStream in, T message, Schema<T> schema)Merges themessagefrom theInputStreamusing the givenschema.static <T> voidmergeFrom(java.io.InputStream in, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)Merges themessagefrom theInputStreamusing the givenschema.static <T> voidmergeFrom(java.io.Reader r, T message, Schema<T> schema)Merges themessagefrom theReaderusing the givenschema.static <T> voidmergeFrom(java.io.Reader r, T message, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)Merges themessagefrom theReaderusing the givenschema.static <T> voidmergeFrom(javax.xml.stream.XMLStreamReader parser, T message, Schema<T> schema)Merges themessagefrom theXMLStreamReaderusing the givenschema.static PipenewPipe(byte[] data)Creates an xml pipe from a byte array.static PipenewPipe(byte[] data, int offset, int length)Creates an xml pipe from a byte array.static PipenewPipe(java.io.InputStream in)Creates an xml pipe from anInputStream.static PipenewPipe(java.io.Reader reader)Creates an xml pipe from aReader.static PipenewPipe(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 themessagesfrom theInputStreamusing the givenschema.static <T> java.util.List<T>parseListFrom(java.io.InputStream in, Schema<T> schema, javax.xml.stream.XMLInputFactory inFactory)Parses themessagesfrom theInputStreamusing the givenschema.static <T> java.util.List<T>parseListFrom(javax.xml.stream.XMLStreamReader parser, Schema<T> schema)Parses themessagesfrom theXMLStreamReaderusing the givenschema.static <T> byte[]toByteArray(T message, Schema<T> schema)Serializes themessageinto a byte array.static <T> byte[]toByteArray(T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)Serializes themessageinto a byte array.static <T> voidwriteListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema)Serializes themessagesinto theOutputStreamusing the given schema.static <T> voidwriteListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)Serializes themessagesinto theOutputStreamusing the given schema.static <T> voidwriteListTo(javax.xml.stream.XMLStreamWriter writer, java.util.List<T> messages, Schema<T> schema)Serializes themessagesinto theXMLStreamWriterusing the given schema.static <T> voidwriteTo(java.io.OutputStream out, T message, Schema<T> schema)Serializes themessageinto anOutputStreamusing the givenschema.static <T> voidwriteTo(java.io.OutputStream out, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)Serializes themessageinto anOutputStreamusing the givenschema.static <T> voidwriteTo(java.io.Writer w, T message, Schema<T> schema)Serializes themessageinto aWriterusing the givenschema.static <T> voidwriteTo(java.io.Writer w, T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)Serializes themessageinto aWriterusing the givenschema.static <T> voidwriteTo(javax.xml.stream.XMLStreamWriter writer, T message, Schema<T> schema)Serializes themessageinto anXMLStreamWriterusing 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 themessagewith the byte array using the givenschema.
-
mergeFrom
public static <T> void mergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema)Merges themessagewith 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 themessagewith the byte array using the givenschema.
-
mergeFrom
public static <T> void mergeFrom(java.io.InputStream in, T message, Schema<T> schema) throws java.io.IOExceptionMerges themessagefrom theInputStreamusing 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.IOExceptionMerges themessagefrom theInputStreamusing the givenschema.- Throws:
java.io.IOException
-
mergeFrom
public static <T> void mergeFrom(java.io.Reader r, T message, Schema<T> schema) throws java.io.IOExceptionMerges themessagefrom theReaderusing 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.IOExceptionMerges themessagefrom theReaderusing 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, XmlInputExceptionMerges themessagefrom theXMLStreamReaderusing the givenschema.- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamExceptionXmlInputException
-
toByteArray
public static <T> byte[] toByteArray(T message, Schema<T> schema)Serializes themessageinto a byte array.
-
toByteArray
public static <T> byte[] toByteArray(T message, Schema<T> schema, javax.xml.stream.XMLOutputFactory outFactory)Serializes themessageinto a byte array.
-
writeTo
public static <T> void writeTo(java.io.OutputStream out, T message, Schema<T> schema) throws java.io.IOExceptionSerializes themessageinto anOutputStreamusing 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.IOExceptionSerializes themessageinto anOutputStreamusing the givenschema.- Throws:
java.io.IOException
-
writeTo
public static <T> void writeTo(java.io.Writer w, T message, Schema<T> schema) throws java.io.IOExceptionSerializes themessageinto aWriterusing 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.IOExceptionSerializes themessageinto aWriterusing 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, XmlOutputExceptionSerializes themessageinto anXMLStreamWriterusing the givenschema.- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamExceptionXmlOutputException
-
writeListTo
public static <T> void writeListTo(java.io.OutputStream out, java.util.List<T> messages, Schema<T> schema) throws java.io.IOExceptionSerializes themessagesinto theOutputStreamusing 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.IOExceptionSerializes themessagesinto theOutputStreamusing 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.XMLStreamExceptionSerializes themessagesinto theXMLStreamWriterusing the given schema.- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
parseListFrom
public static <T> java.util.List<T> parseListFrom(java.io.InputStream in, Schema<T> schema) throws java.io.IOExceptionParses themessagesfrom theInputStreamusing 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.IOExceptionParses themessagesfrom theInputStreamusing 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.XMLStreamExceptionParses themessagesfrom theXMLStreamReaderusing the givenschema.- Throws:
java.io.IOExceptionjavax.xml.stream.XMLStreamException
-
-