public class JSONUtils extends java.lang.Object
KeyedValues,
KeyedValues3D and XYZDataset) and JSON format strings.| Constructor and Description |
|---|
JSONUtils() |
| Modifier and Type | Method and Description |
|---|---|
static KeyedValues<java.lang.String,java.lang.Number> |
readKeyedValues(java.io.Reader reader)
Parses characters from the supplied reader and returns the corresponding
KeyedValues instance. |
static KeyedValues<java.lang.String,java.lang.Number> |
readKeyedValues(java.lang.String json)
Parses the supplied JSON string into a
KeyedValues instance. |
static KeyedValues2D<java.lang.String,java.lang.String,java.lang.Number> |
readKeyedValues2D(java.io.Reader reader)
Reads a data table from a JSON format string coming from the specified
reader.
|
static KeyedValues2D<java.lang.String,java.lang.String,java.lang.Number> |
readKeyedValues2D(java.lang.String json)
Reads a data table from a JSON format string.
|
static KeyedValues3D<java.lang.String,java.lang.String,java.lang.String,java.lang.Number> |
readKeyedValues3D(java.io.Reader reader)
Parses character data from the reader and (if possible) creates a
KeyedValues3D instance. |
static KeyedValues3D<java.lang.String,java.lang.String,java.lang.String,java.lang.Number> |
readKeyedValues3D(java.lang.String json)
Parses the supplied string and (if possible) creates a
KeyedValues3D instance. |
static XYZDataset<java.lang.String> |
readXYZDataset(java.io.Reader reader)
Parses character data from the reader and (if possible) creates an
{XYZDataset} instance that represents the data.
|
static XYZDataset<java.lang.String> |
readXYZDataset(java.lang.String json)
Parses the string and (if possible) creates an {XYZDataset} instance
that represents the data.
|
static java.lang.String |
writeKeyedValues(KeyedValues data)
Returns a string containing the data in JSON format.
|
static void |
writeKeyedValues(KeyedValues data,
java.io.Writer writer)
Writes the data in JSON format to the supplied writer.
|
static java.lang.String |
writeKeyedValues2D(KeyedValues2D data)
Writes a data table to a string in JSON format.
|
static void |
writeKeyedValues2D(KeyedValues2D data,
java.io.Writer writer)
Writes the data in JSON format to the supplied writer.
|
static java.lang.String |
writeKeyedValues3D(KeyedValues3D dataset)
Returns a string containing the data in JSON format.
|
static void |
writeKeyedValues3D(KeyedValues3D dataset,
java.io.Writer writer)
Writes the dataset in JSON format to the supplied writer.
|
static java.lang.String |
writeXYZDataset(XYZDataset dataset)
Returns a string containing the dataset in JSON format.
|
static void |
writeXYZDataset(XYZDataset dataset,
java.io.Writer writer)
Writes the dataset in JSON format to the supplied writer.
|
public JSONUtils()
public static KeyedValues<java.lang.String,java.lang.Number> readKeyedValues(java.lang.String json)
KeyedValues instance.
StandardPieDataset3D).json - the JSON string (null not permitted).KeyedValues instance.public static KeyedValues<java.lang.String,java.lang.Number> readKeyedValues(java.io.Reader reader) throws java.io.IOException
KeyedValues instance.
StandardPieDataset3D).reader - the reader (null not permitted).KeyedValues instance.java.io.IOException - if there is an I/O problem.public static java.lang.String writeKeyedValues(KeyedValues data)
[["Key A", 1.0], ["Key B", 2.0]]
PieDataset3D.data - the data (null not permitted).public static void writeKeyedValues(KeyedValues data, java.io.Writer writer) throws java.io.IOException
PieDataset3D.data - the data (null not permitted).writer - the writer (null not permitted).java.io.IOException - if there is an I/O problem.public static KeyedValues2D<java.lang.String,java.lang.String,java.lang.Number> readKeyedValues2D(java.lang.String json)
json - the string (null not permitted).public static KeyedValues2D<java.lang.String,java.lang.String,java.lang.Number> readKeyedValues2D(java.io.Reader reader) throws java.io.IOException
reader - the reader (null not permitted).java.io.IOException - if there is an I/O problem.public static java.lang.String writeKeyedValues2D(KeyedValues2D data)
data - the data (null not permitted).public static void writeKeyedValues2D(KeyedValues2D data, java.io.Writer writer) throws java.io.IOException
data - the data (null not permitted).writer - the writer (null not permitted).java.io.IOException - if there is an I/O problem.public static KeyedValues3D<java.lang.String,java.lang.String,java.lang.String,java.lang.Number> readKeyedValues3D(java.lang.String json)
KeyedValues3D instance.json - the JSON string (null not permitted).KeyedValues3D instance.public static KeyedValues3D<java.lang.String,java.lang.String,java.lang.String,java.lang.Number> readKeyedValues3D(java.io.Reader reader) throws java.io.IOException
KeyedValues3D instance. This method will read back the data
written by writeKeyedValues3D(
com.orsoncharts.data.KeyedValues3D, java.io.Writer).reader - the reader (null not permitted).KeyedValues3D instance.java.io.IOException - if there is an I/O problem.public static java.lang.String writeKeyedValues3D(KeyedValues3D dataset)
dataset - the data (null not permitted).public static void writeKeyedValues3D(KeyedValues3D dataset, java.io.Writer writer) throws java.io.IOException
dataset - the dataset (null not permitted).writer - the writer (null not permitted).java.io.IOException - if there is an I/O problem.public static XYZDataset<java.lang.String> readXYZDataset(java.lang.String json)
writeXYZDataset(com.orsoncharts.data.xyz.XYZDataset).json - a JSON formatted string (null not permitted).writeXYZDataset(com.orsoncharts.data.xyz.XYZDataset)public static XYZDataset<java.lang.String> readXYZDataset(java.io.Reader reader) throws java.io.IOException
reader - a reader (null not permitted).java.io.IOException - if there is an I/O problem.public static java.lang.String writeXYZDataset(XYZDataset dataset)
dataset - the dataset (null not permitted).public static void writeXYZDataset(XYZDataset dataset, java.io.Writer writer) throws java.io.IOException
dataset - the data (null not permitted).writer - the writer (null not permitted).java.io.IOException - if there is an I/O problem.