Package com.bazaarvoice.jolt
Class JoltCliUtilities
java.lang.Object
com.bazaarvoice.jolt.JoltCliUtilities
A utility class for the Jolt CLI tool.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
createJsonObjectFromFile
(File file, boolean suppressOutput) Uses the File to build a Map containing JSON data found in the file.static boolean
printJsonObject
(Object output, Boolean uglyPrint, boolean suppressOutput) Prints the given json object to standard out, accounting for pretty printing and suppressed output.static void
printToStandardOut
(String output, boolean suppressOutput) Prints the given string to standard out, or doesn't, based on the suppressOutput flagstatic Object
readJsonInput
(File file, boolean suppressOutput) This method will read in JSON, either from the given file or from standard in if the file is null.
-
Field Details
-
DIFFY_COMMAND_IDENTIFIER
- See Also:
-
SORT_COMMAND_IDENTIFIER
- See Also:
-
TRANSFORM_COMMAND_IDENTIFIER
- See Also:
-
-
Constructor Details
-
JoltCliUtilities
public JoltCliUtilities()
-
-
Method Details
-
printToStandardOut
Prints the given string to standard out, or doesn't, based on the suppressOutput flag -
createJsonObjectFromFile
Uses the File to build a Map containing JSON data found in the file. This method will System exit with an error code of 1 if has any trouble opening the file or the file did not contain properly formatted JSON (i.e. the JSON parser was unable to parse its contents)- Returns:
- the Map containing the JSON data
-
printJsonObject
Prints the given json object to standard out, accounting for pretty printing and suppressed output.- Parameters:
output
- The object to print. This method will fail if this object is not well formed JSON.uglyPrint
- ignore pretty printsuppressOutput
- suppress output to standard out- Returns:
- true if printing operation was successful
-
readJsonInput
This method will read in JSON, either from the given file or from standard in if the file is null. An object contain the ingested input is returned.- Parameters:
file
- the file to read the input from, or null to use standard insuppressOutput
- suppress output of error messages to standard out- Returns:
- Object containing input if successful or null if an error occured
-