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> voidMerges themessagewith the byte array using the givenschema.static <T> voidmergeFrom(byte[] data, int offset, int len, T message, Schema<T> schema, XMLInputFactory inFactory) Merges themessagewith the byte array using the givenschema.static <T> voidMerges themessagewith the byte array using the givenschema.static <T> voidmergeFrom(InputStream in, T message, Schema<T> schema) static <T> voidmergeFrom(InputStream in, T message, Schema<T> schema, XMLInputFactory inFactory) static <T> voidstatic <T> voidmergeFrom(Reader r, T message, Schema<T> schema, XMLInputFactory inFactory) static <T> voidmergeFrom(XMLStreamReader parser, T message, Schema<T> schema) 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(InputStream in) Creates an xml pipe from anInputStream.static PipeCreates an xml pipe from aReader.static PipenewPipe(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 themessageinto a byte array.static <T> byte[]toByteArray(T message, Schema<T> schema, XMLOutputFactory outFactory) Serializes themessageinto a byte array.static <T> voidwriteListTo(OutputStream out, List<T> messages, Schema<T> schema) Serializes themessagesinto theOutputStreamusing the given schema.static <T> voidwriteListTo(OutputStream out, List<T> messages, Schema<T> schema, XMLOutputFactory outFactory) Serializes themessagesinto theOutputStreamusing the given schema.static <T> voidwriteListTo(XMLStreamWriter writer, List<T> messages, Schema<T> schema) Serializes themessagesinto theXMLStreamWriterusing the given schema.static <T> voidwriteTo(OutputStream out, T message, Schema<T> schema) static <T> voidwriteTo(OutputStream out, T message, Schema<T> schema, XMLOutputFactory outFactory) static <T> voidstatic <T> voidwriteTo(Writer w, T message, Schema<T> schema, XMLOutputFactory outFactory) static <T> voidwriteTo(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 themessagewith the byte array using the givenschema. -
mergeFrom
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, XMLInputFactory inFactory) Merges themessagewith 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 themessageinto a byte array. -
toByteArray
Serializes themessageinto 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 themessagesinto theOutputStreamusing the given schema.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(OutputStream out, List<T> messages, Schema<T> schema, XMLOutputFactory outFactory) throws IOException Serializes themessagesinto theOutputStreamusing the given schema.- Throws:
IOException
-
writeListTo
public static <T> void writeListTo(XMLStreamWriter writer, List<T> messages, Schema<T> schema) throws IOException, XMLStreamException Serializes themessagesinto theXMLStreamWriterusing the given schema.- Throws:
IOExceptionXMLStreamException
-
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:
IOExceptionXMLStreamException
-