be.six.reports.util
Class FileUtils

java.lang.Object
  extended by be.six.reports.util.FileUtils

public class FileUtils
extends java.lang.Object

Exports a DatabaseResult to a CSV-file.

Author:
Joren Six

Method Summary
static void Export(java.lang.String filename, DatabaseResult resultToExport)
          Write the CSV-file
static java.lang.String readFile(java.lang.String name)
          Reads the contents of a file.
static java.lang.String readFileFromJar(java.lang.String path)
          Reads the contents of a file in the jar.
static void writeFile(java.lang.String contents, java.lang.String name)
          Writes a file to disk.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

Export

public static void Export(java.lang.String filename,
                          DatabaseResult resultToExport)
Write the CSV-file

Parameters:
filename - The name of the file.
resultToExport - The DatabaseResult to export.

writeFile

public static void writeFile(java.lang.String contents,
                             java.lang.String name)
Writes a file to disk. Uses the string contents as content. Fails silently.

Parameters:
contents - The contents of the file.
name - The name of the file to create.

readFile

public static java.lang.String readFile(java.lang.String name)
Reads the contents of a file.

Parameters:
name - the name of the file to read
Returns:
the contents of the file if successful, an empty string otherwise.

readFileFromJar

public static java.lang.String readFileFromJar(java.lang.String path)
Reads the contents of a file in the jar.

Parameters:
path - the path to read e.g. /be/six/reports/ui/help.html
Returns:
the contents of the file when successfull, an empty string otherwise.