void postProcess()

in buildSrc/src/main/java/org/springframework/boot/build/log4j2/ReproducibleLog4j2PluginsDatAction.java [54:87]


	void postProcess(File datFile) throws IOException {
		if (!datFile.isFile()) {
			throw new InvalidUserDataException(
					"META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat not found");
		}
		Map<String, Map<String, Plugin>> categories = new TreeMap<>();
		try (DataInputStream input = new DataInputStream(new FileInputStream(datFile))) {
			int categoryCount = input.readInt();
			for (int i = 0; i < categoryCount; i++) {
				String categoryName = input.readUTF();
				int pluginCount = input.readInt();
				Map<String, Plugin> category = categories.computeIfAbsent(categoryName, (c) -> new TreeMap<>());
				for (int j = 0; j < pluginCount; j++) {
					Plugin plugin = new Plugin(input.readUTF(), input.readUTF(), input.readUTF(), input.readBoolean(),
							input.readBoolean());
					category.putIfAbsent(plugin.key, plugin);
				}
			}
		}
		try (DataOutputStream output = new DataOutputStream(new FileOutputStream(datFile))) {
			output.writeInt(categories.size());
			for (Entry<String, Map<String, Plugin>> category : categories.entrySet()) {
				output.writeUTF(category.getKey());
				output.writeInt(category.getValue().size());
				for (Plugin plugin : category.getValue().values()) {
					output.writeUTF(plugin.key);
					output.writeUTF(plugin.className);
					output.writeUTF(plugin.name);
					output.writeBoolean(plugin.printable);
					output.writeBoolean(plugin.defer);
				}
			}
		}
	}