model.filehandling
Class FileHandler

java.lang.Object
  extended by model.filehandling.FileHandler

public class FileHandler
extends java.lang.Object

Author:
nadim

Constructor Summary
FileHandler()
           
 
Method Summary
static void checkPath(java.lang.String path)
          Creates the path if it doesn't exist
static java.lang.String[] load(java.lang.String filename)
           
static java.lang.String[] readLines(java.io.BufferedReader reader)
          Reads out an array of Strings from a file
static boolean save(java.lang.String path, java.lang.String filename, java.lang.String[] lines)
          Saves an array of Strings out to a file
static void writeLines(java.io.Writer writer, java.lang.String[] lines)
          Writes out an array of Strings to a file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHandler

public FileHandler()
Method Detail

save

public static boolean save(java.lang.String path,
                           java.lang.String filename,
                           java.lang.String[] lines)
Saves an array of Strings out to a file

Parameters:
path -
filename -
lines -
Returns:
true if successful

load

public static java.lang.String[] load(java.lang.String filename)
                               throws java.lang.Exception
Parameters:
filename -
Returns:
Throws:
java.io.FileNotFoundException
java.lang.Exception

checkPath

public static void checkPath(java.lang.String path)
Creates the path if it doesn't exist

Parameters:
path -

writeLines

public static void writeLines(java.io.Writer writer,
                              java.lang.String[] lines)
                       throws java.io.IOException
Writes out an array of Strings to a file

Parameters:
writer -
lines -
Throws:
java.io.IOException

readLines

public static java.lang.String[] readLines(java.io.BufferedReader reader)
                                    throws java.io.IOException
Reads out an array of Strings from a file

Parameters:
reader -
Throws:
java.io.IOException