public static void main(String[] args) throws Exception {
        Charset encoding = UTF_8;
        TikaConfigSerializer.Mode mode = TikaConfigSerializer.Mode.CURRENT;
        String filename = null;

        for (String arg : args) {
            if (arg.startsWith("-")) {
                if (arg.contains("-dump-minimal")) {
                    mode = TikaConfigSerializer.Mode.MINIMAL;
                } else if (arg.contains("-dump-current")) {
                    mode = TikaConfigSerializer.Mode.CURRENT;
                } else if (arg.contains("-dump-static")) {
                    mode = TikaConfigSerializer.Mode.STATIC;
                } else {
                    System.out.println("Use:");
                    System.out.println("  DumpTikaConfig [--dump-minimal] [--dump-current] [--dump-static] [filename] [encoding]");
                    System.out.println("");
                    System.out.println("--dump-minimal    Produce the minimal config file");
                    System.out.println("--dump-current    The current (with defaults) config file");
                    System.out.println("--dump-static     Convert dynamic parts to static");
                    return;
                }
            } else if (filename == null) {
                filename = arg;
            } else {
                encoding = Charset.forName(arg);
            }
        }

        Writer writer = null;
        if (filename != null) {
            writer = new OutputStreamWriter(new FileOutputStream(filename), encoding);
        } else {
            writer = new StringWriter();
        }

        DumpTikaConfigExample ex = new DumpTikaConfigExample();
        TikaConfigSerializer.serialize(TikaConfig.getDefaultConfig(), mode, writer, encoding);

        writer.flush();

        if (writer instanceof StringWriter) {
            System.out.println(writer.toString());
        }
        writer.close();
    }
@param args outputFile, outputEncoding, if args is empty, this prints to console
@throws Exception
tika-example/src/main/java/org/apache/tika/example/DumpTikaConfigExample.java