public class JsonUtil extends Object
This class provides methods to convert a JSON string into a Configuration
instance
and to serialize a Configuration
instance into JSON.
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static Configuration |
parseConfig(boolean lenient,
InputStream[] inputStreams)
Parses a PDFreactor configuration into JSON format.
|
static Configuration |
parseConfig(boolean lenient,
String[] inputs)
Parses a PDFreactor configuration into JSON format.
|
static Configuration |
parseConfig(InputStream[] inputStreams)
Parses a PDFreactor configuration into JSON format.
|
static Configuration |
parseConfig(String[] inputs)
Parses a PDFreactor configuration into JSON format.
|
static String |
serializeConfig(Configuration config)
Serializes a PDFreactor
Configuration instance into a JSON representation. |
public static Configuration parseConfig(InputStream[] inputStreams) throws IOException
Parses a PDFreactor configuration into JSON format.
inputStreams
- The JSON strings which will be merged.Configuration
instance.IOException
- if the JSON string could not be parsed.MissingDependencyException
- if required dependencies are not availablepublic static Configuration parseConfig(boolean lenient, InputStream[] inputStreams) throws IOException
Parses a PDFreactor configuration into JSON format.
lenient
- Whether to be lenient when parsing a config, i.e. ignoring
unknown properties and converting empty types into null.inputStreams
- The JSON strings which will be merged.Configuration
instance.IOException
- if the JSON string could not be parsed.MissingDependencyException
- if required dependencies are not availablepublic static Configuration parseConfig(String[] inputs) throws IOException
Parses a PDFreactor configuration into JSON format.
inputs
- The JSON strings which will be merged.Configuration
instance.IOException
- if the JSON string could not be parsed.MissingDependencyException
- if required dependencies are not availablepublic static Configuration parseConfig(boolean lenient, String[] inputs) throws IOException
Parses a PDFreactor configuration into JSON format.
lenient
- Whether to be lenient when parsing a config, i.e. ignoring
unknown properties and converting empty types into null.inputs
- The JSON strings which will be merged.Configuration
instance.IOException
- if the JSON string could not be parsed.MissingDependencyException
- if required dependencies are not availablepublic static String serializeConfig(Configuration config) throws IOException
Serializes a PDFreactor Configuration
instance into a JSON representation.
Note that the JSON is not an exact representation of the configuration as it truncates
some data types and property values for readability purposes. This means parsing the resulting JSON
with JsonUtil.parseConfig(InputStream...)
may not produce an identical Configuration
.
config
- The Configuration
instance.IOException
- if the Configuration
could not be serialized.MissingDependencyException
- if required dependencies are not availableThis doc was generated on 2023-09-21. Copyright © 2002-2023 RealObjects GmbH. All Rights Reserved.