private void previewInternal(final ConfigSource configSource, final String format) throws IOException {
        final PreviewResult previewResult = this.embed.preview(configSource);

        final PreviewPrinter printer;
        switch (format != null ? format : "table") {
            case "table":
                printer = PreviewPrinter.ofTable(System.out, previewResult.getSchema());
                break;
            case "vertical":
                printer = PreviewPrinter.ofVertical(System.out, previewResult.getSchema());
                break;
            default:
                throw new IllegalArgumentException(
                        "Unknown preview output format '" + format + "'. Supported formats: table, vertical");
        }

        printer.printAllPages(previewResult.getPages());
        printer.finish();
    }
Runs the run subcommand.

It receives a ConfigSource and a String as parameters to be called from Ruby (embulk/runner.rb).
embulk-core/src/main/java/org/embulk/EmbulkRunner.java