deegree 2.2 (2008/12/22 11:33 build-3038-official)

org.deegree.framework.util
Class FileUtils

java.lang.Object
  extended by org.deegree.framework.util.FileUtils

public class FileUtils
extends Object

the class offeres several static methods for handling file access

Since:
2.0
Version:
$Revision: 9339 $, 1.0. $Revision: 9339 $, $Date: 2007-12-27 13:31:52 +0100 (Do, 27 Dez 2007) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Constructor Summary
FileUtils()
           
 
Method Summary
static void appendsToFile(String fileName, String data)
          appends the passed string to the file identified by the passed name.
static StringBuffer readTextFile(File file)
          reads a Text file from its resource.
static StringBuffer readTextFile(InputStream is)
          reads a Text file from its resource.
static StringBuffer readTextFile(Reader reader)
          reads a Text file from its resource.
static StringBuffer readTextFile(URL url)
          reads a Text file from its resource.
static void writeToFile(String fileName, String data)
          writes the the passed string to a file created using the passed file name.
static void writeToFile(String fileName, String data, String encoding)
          writes the the passed string to a file created using the passed file name using the defined character encoding.
 
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

writeToFile

public static final void writeToFile(String fileName,
                                     String data)
                              throws IOException
writes the the passed string to a file created using the passed file name. For writing to the resource an OutputStreamReader with encoding read from CharsetUtils.getSystemCharset().

Parameters:
fileName -
data -
Throws:
IOException

writeToFile

public static final void writeToFile(String fileName,
                                     String data,
                                     String encoding)
                              throws IOException
writes the the passed string to a file created using the passed file name using the defined character encoding.

Parameters:
fileName -
data -
encoding -
Throws:
IOException

appendsToFile

public static final void appendsToFile(String fileName,
                                       String data)
                                throws IOException
appends the passed string to the file identified by the passed name. If the file does not exist an exception will be thrown.

Parameters:
fileName -
data -
Throws:
IOException

readTextFile

public static StringBuffer readTextFile(File file)
                                 throws IOException
reads a Text file from its resource. For accessing the resource an InputStreamReader with encoding read from CharsetUtils.getSystemCharset()

Parameters:
file -
Returns:
Throws:
IOException

readTextFile

public static StringBuffer readTextFile(URL url)
                                 throws IOException
reads a Text file from its resource. For accessing the resource an InputStreamReader with encoding read from CharsetUtils.getSystemCharset()

Parameters:
url -
Returns:
Throws:
IOException

readTextFile

public static StringBuffer readTextFile(InputStream is)
                                 throws IOException
reads a Text file from its resource. For accessing the resource an InputStreamReader with encoding read from CharsetUtils.getSystemCharset()

Parameters:
is -
Returns:
Throws:
IOException

readTextFile

public static StringBuffer readTextFile(Reader reader)
                                 throws IOException
reads a Text file from its resource.

Parameters:
reader -
Returns:
Throws:
IOException

deegree 2.2 (2008/12/22 11:33 build-3038-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://deegree.sourceforge.net