org.eclipse.swtbot.swt.finder.utils
Class FileUtils

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.utils.FileUtils

public class FileUtils
extends Object

Provides utilities to read and write to files.

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Constructor Summary
FileUtils()
           
 
Method Summary
static void mkdirs(File destination)
          Creates directory specified by destination, and all its parents if they don't exist.
static void mkdirs(String destination)
          Creates directory specified by destination, and all its parents if they don't exist.
static String read(File file)
           
static String read(InputStream in)
           
static String read(Reader in)
           
static String read(String filePath)
           
static String read(URL url)
           
static List<String> readlines(String file)
           
static void write(String text, File file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

read

public static String read(String filePath)
Parameters:
filePath - the path to the file.
Returns:
the contents of the file in filePath.

read

public static String read(File file)
Parameters:
file - the file to read from.
Returns:
the contents of the file.

read

public static String read(InputStream in)
Parameters:
in - the input stream to read from.
Returns:
the contents of the inputstream.

read

public static String read(URL url)
Parameters:
url - the URL to read from.
Returns:
the contents of the url.

read

public static String read(Reader in)
Parameters:
in - the reader to read from.
Returns:
the contents of the reader.

readlines

public static List<String> readlines(String file)

write

public static void write(String text,
                         File file)
Parameters:
text - the contents to write to the file.
file - the file to write to.

mkdirs

public static void mkdirs(String destination)
Creates directory specified by destination, and all its parents if they don't exist.

Parameters:
destination - the directory to create.

mkdirs

public static void mkdirs(File destination)
Creates directory specified by destination, and all its parents if they don't exist.

Parameters:
destination - the directory to create.