Class PrettyPrinter
java.lang.Object
dev.metaschema.oscal.tools.cli.core.utils.PrettyPrinter
Utility class for pretty-printing output files in various formats.
This class was originally contributed by Mahesh Kumar Gaddam (ermahesh) in PR #295.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidprettyPrintJson(File file) Pretty-prints a JSON file in place.static voidprettyPrintXml(File file) Pretty-prints an XML file in place.static voidprettyPrintYaml(File file) Pretty-prints a YAML file in place.
-
Method Details
-
prettyPrintJson
Pretty-prints a JSON file in place.- Parameters:
file- the JSON file to pretty-print- Throws:
IOException- if an I/O error occurs
-
prettyPrintYaml
Pretty-prints a YAML file in place.- Parameters:
file- the YAML file to pretty-print- Throws:
IOException- if an I/O error occurs
-
prettyPrintXml
public static void prettyPrintXml(@NonNull File file) throws IOException, ParserConfigurationException, SAXException, TransformerException Pretty-prints an XML file in place.- Parameters:
file- the XML file to pretty-print- Throws:
IOException- if an I/O error occursParserConfigurationException- if a DocumentBuilder cannot be createdSAXException- if any parse errors occurTransformerException- if an error occurs during transformation
-