de.stueckseln.buildtools.utils
Class FileHelper

java.lang.Object
  extended by de.stueckseln.buildtools.utils.FileHelper

public class FileHelper
extends java.lang.Object

A simple file helper class for reading an writing files Methods here may do the same stuff Apache Commons IO do, but requiring AC/IO for reading/writing a file in such a small tool is over loaded.


Field Summary
static int BUFFER_SIZE
           
 
Constructor Summary
FileHelper()
           
 
Method Summary
static void readFile(java.io.File file, java.lang.StringBuffer buf)
          Read file into supplied StringBuffer
static java.lang.String readFileToString(java.io.File file)
          Read file and return as String
static void writeFile(java.lang.StringBuffer buf, java.io.File file)
          Write a StringBuffer to a file
static void writeFile(java.lang.String str, java.io.File file)
          Write a String to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

FileHelper

public FileHelper()
Method Detail

readFile

public static void readFile(java.io.File file,
                            java.lang.StringBuffer buf)
                     throws java.io.IOException
Read file into supplied StringBuffer

Parameters:
file - file to read from
buf - StringBuffer to write file contents to
Throws:
java.io.IOException

readFileToString

public static java.lang.String readFileToString(java.io.File file)
                                         throws java.io.IOException
Read file and return as String

Parameters:
file - file to read from
Throws:
java.io.IOException

writeFile

public static void writeFile(java.lang.String str,
                             java.io.File file)
                      throws java.io.IOException
Write a String to a file

Parameters:
str - string to write
file - File instance denoting a file to write to
Throws:
java.io.IOException

writeFile

public static void writeFile(java.lang.StringBuffer buf,
                             java.io.File file)
                      throws java.io.IOException
Write a StringBuffer to a file

Parameters:
buf - string to write
file - File instance denoting a file to write to
Throws:
java.io.IOException