class DefaultMultipleOutputWriter implements MultipleOutputWriter {

    @Override
    public void addOutput(PopulatedFileOutput fileOutput) {
        if (nonNull(multipleFiles.putIfAbsent(fileOutput.getName(), fileOutput.getFile()))) {
            // we already have a file with the same name, this shouldn't happen but could happen in split by text or bookmarks
            int count = 1;
            String basename = getBaseName(fileOutput.getName());
            String extension = getExtension(fileOutput.getName());

            while (nonNull(
                    multipleFiles.putIfAbsent(format("%s(%d).%s", basename, count, extension), fileOutput.getFile()))
                    && count < 100) {
                count++;
            }
        }
    }

      DefaultMultipleOutputWriter(ExistingOutputPolicy existingOutputPolicy, TaskExecutionContext executionContext);

}