Class JoltCliUtilities

java.lang.Object
com.bazaarvoice.jolt.JoltCliUtilities

public class JoltCliUtilities extends Object
A utility class for the Jolt CLI tool.
  • Field Details

  • Constructor Details

    • JoltCliUtilities

      public JoltCliUtilities()
  • Method Details

    • printToStandardOut

      public static void printToStandardOut(String output, boolean suppressOutput)
      Prints the given string to standard out, or doesn't, based on the suppressOutput flag
    • createJsonObjectFromFile

      public static Object createJsonObjectFromFile(File file, boolean suppressOutput)
      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

      public static boolean printJsonObject(Object output, Boolean uglyPrint, boolean suppressOutput)
      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 print
      suppressOutput - suppress output to standard out
      Returns:
      true if printing operation was successful
    • readJsonInput

      public static 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. An object contain the ingested input is returned.
      Parameters:
      file - the file to read the input from, or null to use standard in
      suppressOutput - suppress output of error messages to standard out
      Returns:
      Object containing input if successful or null if an error occured