Package org.apache.avro.tool
Class TrevniToJsonTool
java.lang.Object
org.apache.avro.tool.TrevniToJsonTool
- All Implemented Interfaces:
Tool
Tool to read Trevni files and print them as JSON. This can read any Trevni
file. Nested structure is reconstructed from the columns rather than any
schema information.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Name of tool, to be used in listings.1-line description to be used in command listings.intrun(InputStream stdin, PrintStream out, PrintStream err, List<String> args) Runs the tool with supplied arguments.voidtoJson(Input input, PrintStream out, boolean pretty) Read a Trevni file and print each row as a JSON object.
-
Constructor Details
-
TrevniToJsonTool
public TrevniToJsonTool()
-
-
Method Details
-
getName
Description copied from interface:ToolName of tool, to be used in listings. -
getShortDescription
Description copied from interface:Tool1-line description to be used in command listings.- Specified by:
getShortDescriptionin interfaceTool
-
run
public int run(InputStream stdin, PrintStream out, PrintStream err, List<String> args) throws Exception Description copied from interface:ToolRuns the tool with supplied arguments. Input and output streams are customizable for easier testing.- Specified by:
runin interfaceTool- Parameters:
stdin- Input stream to read data (typically System.in).out- Output of tool (typically System.out).err- Error stream (typically System.err).args- Non-null list of arguments.- Returns:
- result code (0 for success)
- Throws:
Exception- Just like main(), tools may throw Exception.
-
toJson
Read a Trevni file and print each row as a JSON object.- Throws:
IOException
-