class FileUtils {

	// forbids instantiation
	private FileUtils() {
	}

	/**
	 * Set up output file for batch processing. This method implements common logic for
	 * handling output files when starting or restarting file I/O. When starting output
	 * file processing, creates/overwrites new file. When restarting output file
	 * processing, checks whether file is writable.
	 * @param file file to be set up
	 * @param restarted true signals that we are restarting output file processing
	 * @param append true signals input file may already exist (but doesn't have to)
	 * @param overwriteOutputFile If set to true, output file will be overwritten (this
	 * flag is ignored when processing is restart)
	 */
	public static void setUpOutputFile(File file, boolean restarted, boolean append, boolean overwriteOutputFile) {<FILL_FUNCTION_BODY>}

	/**
	 * Create a new file if it doesn't already exist.
	 * @param file the file to create on the filesystem
	 * @return true if file was created else false.
	 * @throws IOException is thrown if error occurs during creation and file does not
	 * exist.
	 */
	public static boolean createNewFile(File file) throws IOException {

		if (file.exists()) {
			return false;
		}

		try {
			return file.createNewFile() && file.exists();
		}
		catch (IOException e) {
			// On some file systems you can get an exception here even though the
			// files was successfully created
			if (file.exists()) {
				return true;
			}
			else {
				throw e;
			}
		}

	}

}


		Assert.notNull(file, "An output file is required");

		try {
			if (!restarted) {
				if (!append) {
					if (file.exists()) {
						if (!overwriteOutputFile) {
							throw new ItemStreamException("File already exists: [" + file.getAbsolutePath() + "]");
						}
						if (!file.delete()) {
							throw new IOException("Could not delete file: " + file);
						}
					}

					if (file.getParent() != null) {
						new File(file.getParent()).mkdirs();
					}
					if (!createNewFile(file)) {
						throw new ItemStreamException("Output file was not created: [" + file.getAbsolutePath() + "]");
					}
				}
				else {
					if (!file.exists()) {
						if (file.getParent() != null) {
							new File(file.getParent()).mkdirs();
						}
						if (!createNewFile(file)) {
							throw new ItemStreamException(
									"Output file was not created: [" + file.getAbsolutePath() + "]");
						}
					}
				}
			}
		}
		catch (IOException ioe) {
			throw new ItemStreamException("Unable to create file: [" + file.getAbsolutePath() + "]", ioe);
		}

		if (!file.canWrite()) {
			throw new ItemStreamException("File is not writable: [" + file.getAbsolutePath() + "]");
		}
	
<no_super_class>