Modifier and Type | Method and Description |
---|---|
static <T> T |
fromJson(InputStream is)
Deserialize from a JSON
InputStream . |
static <T> T |
fromJson(Reader r)
Deserialize from a JSON
Reader . |
static <T> T |
fromJson(String s)
Deserialize from a JSON
String . |
static <T> T |
fromXml(InputStream is)
Deserialize from a XML
InputStream . |
static <T> T |
fromXml(Reader r)
Deserialize from a XML
Reader . |
static <T> T |
fromXml(String s)
Deserialize from a XML
String . |
static String |
toJson(Object o)
Serialize to JSON
String . |
static void |
toJson(Object o,
OutputStream os)
Serialize to JSON using an
OutputStream . |
static void |
toJson(Object o,
Writer w)
Serialize to JSON using a
Writer . |
static String |
toXml(Object o)
Serialize to JSON
String . |
static void |
toXml(Object o,
OutputStream os)
Serialize to XML using an
OutputStream . |
static void |
toXml(Object o,
Writer w)
Serialize to XML using a
Writer . |
static XStream |
xstream(boolean isXml)
Retrieves a custom
XStream pre-configured for de/serializing DML
AST and symbol table. |
public static <T> T fromJson(InputStream is)
InputStream
.is
- The JSON InputStream
.public static <T> T fromJson(Reader r)
Reader
.r
- The JSON Reader
.public static <T> T fromJson(String s)
String
.s
- The JSON String
.public static <T> T fromXml(InputStream is)
InputStream
.is
- The XML InputStream
.public static <T> T fromXml(Reader r)
Reader
.r
- The XML Reader
.public static <T> T fromXml(String s)
String
.s
- The XML String
.public static String toJson(Object o)
String
.o
- The object to serialize.String
representation of the provided object.public static void toJson(Object o, OutputStream os)
OutputStream
.o
- The object to serialize.os
- The OutputStream
to write the JSON representation to.public static void toJson(Object o, Writer w)
Writer
.o
- The object to serialize.w
- The Writer
to write the JSON representation to.public static String toXml(Object o)
String
.o
- The object to serialize.String
representation of the provided object.public static void toXml(Object o, OutputStream os)
OutputStream
.o
- The object to serialize.os
- The OutputStream
to write the XML representation to.public static void toXml(Object o, Writer w)
Writer
.o
- The object to serialize.w
- The Writer
to write the XML representation to.