public final class JSONSupport
extends Object
Modifier and Type | Method and Description |
---|---|
static XMLDocument |
load(File file)
Loads an XML document from a JSON file.
|
static XMLDocument |
load(URL url,
Optional<String> encoding)
Loads an XML document from a JSON URL.
|
static XMLElement |
parse(File file)
Parses JSON from a file.
|
static XMLElement |
parse(InputStream inputStream)
Parses JSON from an input stream.
|
static XMLElement |
parse(Reader reader)
Parses JSON from a reader.
|
static XMLElement |
parse(String string)
Parses JSON from a file.
|
static XMLElement |
parse(URL url)
Parses JSON from an URL.
|
static String |
toJSON(XMLDocument source)
Converts an XML document to a JSON string.
|
static void |
toJSON(XMLDocument source,
Writer writer)
Converts an XML document to JSON writer.
|
@Nullable @CheckReturnValue public static XMLDocument load(@Nonnull File file)
file
- The JSON file.@Nullable @CheckReturnValue public static XMLDocument load(@Nonnull URL url, @Nonnull Optional<String> encoding)
url
- The JSON URL.encoding
- The optional character encoding name.@Nonnull @CheckReturnValue public static XMLElement parse(@Nonnull File file) throws XMLDocument.ParseException
file
- The JSON file.XMLDocument.ParseException
- When appropriate.@Nonnull @CheckReturnValue public static XMLElement parse(@Nonnull InputStream inputStream) throws XMLDocument.ParseException
inputStream
- An input stream for the JSON text.XMLDocument.ParseException
- When appropriate.@Nonnull @CheckReturnValue public static XMLElement parse(@Nonnull Reader reader) throws XMLDocument.ParseException
reader
- A reader for the JSON text.XMLDocument.ParseException
- When appropriate.@Nonnull @CheckReturnValue public static XMLElement parse(@Nonnull String string) throws XMLDocument.ParseException
string
- The JSON string.XMLDocument.ParseException
- When appropriate.@Nonnull @CheckReturnValue public static XMLElement parse(@Nonnull URL url) throws XMLDocument.ParseException
url
- The URL of the JSON text.XMLDocument.ParseException
- When appropriate.@Nonnull @CheckReturnValue public static String toJSON(@Nonnull XMLDocument source)
source
- The XML document.public static void toJSON(@Nonnull XMLDocument source, @Nonnull Writer writer) throws IOException
source
- The XML document.writer
- The JSON writer.IOException
- From the destination.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.