ec.app.sequence
Class FileUtil

java.lang.Object
  extended by ec.app.sequence.FileUtil

public class FileUtil
extends java.lang.Object


Constructor Summary
FileUtil()
           
 
Method Summary
static void close()
           
static void quickWrite(java.lang.String data)
           
static java.util.List readTextFileToStringList(java.io.File f, boolean trimWhiteSpace)
          Reads the lines of a text file.
static void writeStringToTextFile(java.io.File f, java.lang.String text, boolean append)
          Writes a string into a text file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

quickWrite

public static void quickWrite(java.lang.String data)
                       throws java.lang.Exception
Throws:
java.lang.Exception

close

public static void close()
                  throws java.lang.Exception
Throws:
java.lang.Exception

writeStringToTextFile

public static void writeStringToTextFile(java.io.File f,
                                         java.lang.String text,
                                         boolean append)
                                  throws java.io.IOException
Writes a string into a text file.

Parameters:
f - the file to be written
text - the string to write
append - true to append to an existing file
utf8 - writes the text to an UTF8 encoded file
Throws:
java.io.IOException

readTextFileToStringList

public static java.util.List readTextFileToStringList(java.io.File f,
                                                      boolean trimWhiteSpace)
                                               throws java.io.IOException
Reads the lines of a text file.

Parameters:
f - the file to be read
trimWhiteSpace - if true , all white space in front and at the end of a line will be romved, new line characters inclusive.
utf8 - reads from an UTF8 encoded file
Returns:
a list of strings, one for each line
Throws:
java.io.IOException