/**
 *	Written 2006-10 By Filip Ekberg
 *	School Project on BTH - Software Engineering
 *
 *	Copyright (C)
 *
 *
 *	This class is used to control input in a textfield ( Text Only )
 *	This is an easy way to control text input.
 */

import java.io.*;

public class FileHandler 
{
	public static boolean Save(String filename, String text)
	{
		try
		{
			BufferedWriter output = new BufferedWriter(new FileWriter(filename));
			output.write(text);
			output.close();
		}
		catch(IOException ex)
		{
			return false;
		}
		return true;
	}
	public static String Load(String filename)
	{
		String in;
		try
		{
			BufferedReader input = new BufferedReader(new FileReader(filename));
			in = input.readLine();
			if ( in == null )
				return "Empty";
				
			input.close();
		}
		catch(IOException ex)
		{
			return "Empty";
		}
		
		return in;
	}
}
