com.virtuosotechnologies.lib.util
Class FileUtils

java.lang.Object
  extended bycom.virtuosotechnologies.lib.util.FileUtils

public final class FileUtils
extends Object

Various utilities for files and streams.


Method Summary
static Reader createUTFReader(InputStream stream)
          Return an appropriate UTF-8 or UTF-16 Reader for the given InputStream, based on an optional leading byte order mark.
static String readCompletely(Reader reader)
          Read a stream completely into a string
static String readFileCompletely(File file)
          Read a file completely into a string
static String readResourceCompletely(Class parentClass, String name)
          Read a resource completely into a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readCompletely

public static String readCompletely(Reader reader)
                             throws IOException
Read a stream completely into a string

Parameters:
reader - stream to read
Returns:
string
Throws:
IOException

readFileCompletely

public static String readFileCompletely(File file)
                                 throws IOException
Read a file completely into a string

Parameters:
file - File to read
Returns:
string
Throws:
IOException

readResourceCompletely

public static String readResourceCompletely(Class parentClass,
                                            String name)
                                     throws IOException
Read a resource completely into a string

Parameters:
parentClass - class the resource is relative to
name - resource name
Returns:
string
Throws:
IOException

createUTFReader

public static Reader createUTFReader(InputStream stream)
                              throws IOException
Return an appropriate UTF-8 or UTF-16 Reader for the given InputStream, based on an optional leading byte order mark.

Parameters:
stream - InputStream to wrap
Returns:
an appropriate Reader
Throws:
IOException