private static void dump( File dir, String nameSuffix,
		LookAndFeel lookAndFeel, UIDefaults defaults, Predicate<String> keyFilter, boolean contrastRatios )
	{
		// dump to string
		StringWriter stringWriter = new StringWriter( 100000 );
		new UIDefaultsDump( lookAndFeel, defaults ).dump( new PrintWriter( stringWriter ), keyFilter, contrastRatios );

		String name = lookAndFeel instanceof MyBasicLookAndFeel
			? BasicLookAndFeel.class.getSimpleName()
			: lookAndFeel.getClass().getSimpleName();
		String osSuffix = (SystemInfo.isMacOS && lookAndFeel instanceof FlatLaf)
			? "-mac"
			: ((SystemInfo.isLinux && lookAndFeel instanceof FlatLaf)
				? "-linux"
				: "");
		String javaVersion = System.getProperty( "java.version" );
		if( javaVersion.startsWith( "1.8.0_" ) && lookAndFeel instanceof FlatLaf )
			javaVersion = "1.8.0";
		File file = new File( dir, name + nameSuffix + "_"
			+ javaVersion + osSuffix + ".txt" );

		// build differences
		String content;
		File origFile = null;
		if( !osSuffix.isEmpty() && nameSuffix.isEmpty() )
			origFile = new File( dir, name + nameSuffix + "_" + javaVersion + ".txt" );
		else if( lookAndFeel instanceof FlatIntelliJLaf && SystemInfo.isWindows )
			origFile = new File( dir, "FlatLightLaf_" + javaVersion + ".txt" );
		else if( lookAndFeel instanceof FlatDarculaLaf && SystemInfo.isWindows )
			origFile = new File( dir, "FlatDarkLaf_" + javaVersion + ".txt" );
		else if( defaults.getBoolean( "jidesoft.extensionInstalled" ) ) {
			origFile = file;
			file = new File( file.getParentFile(), "JIDE-" + file.getName() );
		}
		if( origFile != null ) {
			try {
				Map<String, String> defaults1 = parse( new InputStreamReader(
					new FileInputStream( origFile ), StandardCharsets.UTF_8 ), false );
				Map<String, String> defaults2 = parse( new StringReader( stringWriter.toString() ), false );

				content = diff( defaults1, defaults2 );
			} catch( Exception ex ) {
				ex.printStackTrace();
				return;
			}
		} else
			content = stringWriter.toString().replace( "\r", "" );

		// write to file
		file.getParentFile().mkdirs();
		try( Writer fileWriter = new OutputStreamWriter(
			new FileOutputStream( file ), StandardCharsets.UTF_8 ) )
		{
			fileWriter.write( content );
		} catch( IOException ex ) {
			ex.printStackTrace();
		}
	}
Dumps look and feel UI defaults to files.

@author Karl Tauber
flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java