<commit_before>package com.google.code.maven_replacer_plugin.file;

import java.io.File;
import java.io.IOException;

public class FileUtils {
	public boolean fileNotExists(String filename) {
		if (filename == null || filename.trim().length() == 0) {
			return true;
		}
		return !new File(filename).exists();
	}

	public void ensureFolderStructureExists(String file) {
		File outputFile = new File(file);
		if (outputFile.getParent() == null) {
			return;
		}

		if (!outputFile.isDirectory()) {
			File parentPath = new File(outputFile.getParent());
			if (!parentPath.exists()) {
				parentPath.mkdirs();
			}
		} else {
			throw new IllegalArgumentException("OutputFile cannot be a directory: " + file);
		}
	}

	public String readFile(String file) throws IOException {
		return org.apache.commons.io.FileUtils.readFileToString(new File(file));
	}

	public void writeToFile(String outputFile, String content) throws IOException {
		ensureFolderStructureExists(outputFile);
		org.apache.commons.io.FileUtils.writeStringToFile(new File(outputFile), content);
	}<commit_msg>throwing error if cannot create dir when dir not exists, could be from security or some other problem making the dir<commit_after>package com.google.code.maven_replacer_plugin.file;

import java.io.File;
import java.io.IOException;

public class FileUtils {
	public boolean fileNotExists(String filename) {
		if (filename == null || filename.trim().length() == 0) {
			return true;
		}
		return !new File(filename).exists();
	}

	public void ensureFolderStructureExists(String file) {
		File outputFile = new File(file);
		if (outputFile.getParent() == null) {
			return;
		}

		if (!outputFile.isDirectory()) {
			File parentPath = new File(outputFile.getParent());
			if (!parentPath.exists() && !parentPath.mkdirs()) {
				throw new Error("Error creating directory.");
			}
		} else {
			throw new IllegalArgumentException("OutputFile cannot be a directory: " + file);
		}
	}

	public String readFile(String file) throws IOException {
		return org.apache.commons.io.FileUtils.readFileToString(new File(file));
	}

	public void writeToFile(String outputFile, String content) throws IOException {
		ensureFolderStructureExists(outputFile);
		org.apache.commons.io.FileUtils.writeStringToFile(new File(outputFile), content);
	}
{'fraction_non_alphanumeric': 0.11685490877497828, 'fraction_numerical': 0.0008688097306689834, 'mean_word_length': 4.7575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6962482', 'n_tokens_mistral': 737, 'n_tokens_neox': 667, 'n_words': 176}