// Path: RPi-Java-LedTable/src/net/mdp3/java/util/file/SimpleFileIO.java
// public class SimpleFileIO {
// 	
// 	public static void writeStringToFile(String fileName, String s) throws IOException {
// 		writeStringToFile(new File(fileName), s);
// 	}
// 	
// 	public static void writeStringToFile(File file, String s) throws IOException {
// 		BufferedWriter bw = null;
// 		
// 		bw = new BufferedWriter(new FileWriter(file));
// 		bw.write(s);
// 		bw.close();
// 	}
// 	
// 	public static String loadFileToString(String fileName) throws FileNotFoundException {
// 		return loadFileToString(new File(fileName));
// 	}
// 	
// 	public static String loadFileToString(File file) throws FileNotFoundException {
// 		StringBuilder sb = new StringBuilder();
// 		Scanner sc = new Scanner(file);
// 		
// 		while (sc.hasNext()) {
// 			sb.append(sc.nextLine()).append("\n");
// 		}
// 		sc.close();
// 		
// 		return sb.toString();
// 	}
// 	
// 	public static void appendStringToFile(String fileName, String s) throws IOException, FileNotFoundException {
// 		appendStringToFile(new File(fileName), s);
// 	}
// 	
// 	public static void appendStringToFile(File file, String s) throws IOException, FileNotFoundException {
// 		String fileContents = loadFileToString(file);
// 		
// 		if (!fileContents.endsWith("\n")) fileContents += "\n";
// 		fileContents += s;
// 		
// 		writeStringToFile(file, fileContents);
// 	}
// }


import net.mdp3.java.util.file.SimpleFileIO;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
 * 
 */
package net.mdp3.java.util.test;



/**
 * Test script for the SimpleFileIO class.
 * 
 * Writes a string to a file, loads the file, then appends a string to file 
 * and reloads the contents.
 * 
 * @author Mikel
 *
 */
public class SimpleFileIOTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String text = "Test String!!@RWSF";
		try {
// Path: RPi-Java-LedTable/src/net/mdp3/java/util/file/SimpleFileIO.java
// public class SimpleFileIO {
// 	
// 	public static void writeStringToFile(String fileName, String s) throws IOException {
// 		writeStringToFile(new File(fileName), s);
// 	}
// 	
// 	public static void writeStringToFile(File file, String s) throws IOException {
// 		BufferedWriter bw = null;
// 		
// 		bw = new BufferedWriter(new FileWriter(file));
// 		bw.write(s);
// 		bw.close();
// 	}
// 	
// 	public static String loadFileToString(String fileName) throws FileNotFoundException {
// 		return loadFileToString(new File(fileName));
// 	}
// 	
// 	public static String loadFileToString(File file) throws FileNotFoundException {
// 		StringBuilder sb = new StringBuilder();
// 		Scanner sc = new Scanner(file);
// 		
// 		while (sc.hasNext()) {
// 			sb.append(sc.nextLine()).append("\n");
// 		}
// 		sc.close();
// 		
// 		return sb.toString();
// 	}
// 	
// 	public static void appendStringToFile(String fileName, String s) throws IOException, FileNotFoundException {
// 		appendStringToFile(new File(fileName), s);
// 	}
// 	
// 	public static void appendStringToFile(File file, String s) throws IOException, FileNotFoundException {
// 		String fileContents = loadFileToString(file);
// 		
// 		if (!fileContents.endsWith("\n")) fileContents += "\n";
// 		fileContents += s;
// 		
// 		writeStringToFile(file, fileContents);
// 	}
// }


// Path: RPi-Java-LedTable/src/net/mdp3/java/util/test/SimpleFileIOTest.java
import net.mdp3.java.util.file.SimpleFileIO;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * 
 */
package net.mdp3.java.util.test;



/**
 * Test script for the SimpleFileIO class.
 * 
 * Writes a string to a file, loads the file, then appends a string to file 
 * and reloads the contents.
 * 
 * @author Mikel
 *
 */
public class SimpleFileIOTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String text = "Test String!!@RWSF";
		try {
			SimpleFileIO.writeStringToFile("test.txt", text);