package com.tcolligan.maximmaker.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * A utility class with static methods to help with common file operations.
 *
 * Created on 7/24/2016.
 *
 * @author Thomas Colligan
 */
public class FileUtils
{
    //==============================================================================================
    // Constructor
    //==============================================================================================

    private FileUtils()
    {
        // Private constructor to make sure that nobody can instantiate this utility class.
    }

    //==============================================================================================
    // Static Helper Methods
    //==============================================================================================

    public static String retrieveFileDataAsText(File file) throws IOException
    {
        StringBuilder stringBuilder = new StringBuilder();
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
        String line;

        while ((line = bufferedReader.readLine()) != null)
        {
            stringBuilder.append(line);
        }

        bufferedReader.close();

        return stringBuilder.toString();
    }

    public static boolean createNewFileIfFileDoesNotExist(File file) throws IOException
    {
        if (!file.exists())
        {
            return file.createNewFile();
        }

        return true;
    }
}

@@ -229,24 +229,29 @@
 rations.%0D%0A *
+ %3Cp/%3E
 %0D%0A * Created
@@ -1498,13 +1498,15 @@
     
-if (!
+return 
 file
@@ -1518,96 +1518,32 @@
 ts()
-)%0D%0A        %7B%0D%0A            return file.createNewFile();%0D%0A        %7D%0D%0A%0D%0A        return true
+ %7C%7C file.createNewFile()
 ;%0D%0A 

Simplify FileUtils function