moj.util
Class FileTools

java.lang.Object
  extended by moj.util.FileTools

public class FileTools
extends java.lang.Object

A small utility class that contains methods for handling files.

Version:
2006-Dec-08
Author:
Martin Hassel

Constructor Summary
FileTools()
           
 
Method Summary
static java.lang.String readFile2String(java.lang.String filename)
          Reads a file into a String using cpdetector for code page detection.
static java.lang.String readFile2String(java.lang.String filename, java.nio.charset.Charset cs)
          Reads a file into a String using the provided charset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTools

public FileTools()
Method Detail

readFile2String

public static java.lang.String readFile2String(java.lang.String filename)
Reads a file into a String using cpdetector for code page detection.

Parameters:
filename - name of the file to read into a String
Returns:
a String containing the given file (line breaks preserved)

readFile2String

public static java.lang.String readFile2String(java.lang.String filename,
                                               java.nio.charset.Charset cs)
Reads a file into a String using the provided charset.

Parameters:
filename - name of the file to read into a String
cs - the Charset to use when reading the file
Returns:
a String containing the given file (line breaks preserved)