at.gv.egovernment.moa.util
Class FileUtils
java.lang.Object
|
+--at.gv.egovernment.moa.util.FileUtils
- public class FileUtils
- extends Object
Utility for accessing files on the file system, and for reading from input streams.
- Version:
- $Id$
- Author:
- Paul Ivancsics
Method Summary |
static byte[] |
readFile(String filename)
Reads a file, given by filename, into a byte array. |
static String |
readFile(String filename,
String encoding)
Reads a file, given by filename, into a String. |
static byte[] |
readResource(String name)
Reads a file from a resource. |
static String |
readResource(String name,
String encoding)
Reads a file from a resource. |
static byte[] |
readURL(String urlString)
Reads a file, given by URL, into a byte array. |
static String |
readURL(String urlString,
String encoding)
Reads a file, given by URL, into a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileUtils
public FileUtils()
readURL
public static byte[] readURL(String urlString)
throws IOException
- Reads a file, given by URL, into a byte array.
- Parameters:
urlString
- file URL- Returns:
- file content
- Throws:
IOException
- on any exception thrown
readURL
public static String readURL(String urlString,
String encoding)
throws IOException
- Reads a file, given by URL, into a String.
- Parameters:
urlString
- file URLencoding
- character encoding- Returns:
- file content
- Throws:
IOException
- on any exception thrown
readFile
public static byte[] readFile(String filename)
throws IOException
- Reads a file, given by filename, into a byte array.
- Parameters:
filename
- filename- Returns:
- file content
- Throws:
IOException
- on any exception thrown
readFile
public static String readFile(String filename,
String encoding)
throws IOException
- Reads a file, given by filename, into a String.
- Parameters:
filename
- filenameencoding
- character encoding- Returns:
- file content
- Throws:
IOException
- on any exception thrown
readResource
public static byte[] readResource(String name)
throws IOException
- Reads a file from a resource.
- Parameters:
name
- resource name- Returns:
- file content as a byte array
- Throws:
IOException
- on any exception thrown
readResource
public static String readResource(String name,
String encoding)
throws IOException
- Reads a file from a resource.
- Parameters:
name
- filenameencoding
- character encoding- Returns:
- file content
- Throws:
IOException
- on any exception thrown