Package at.gv.egovernment.moaspss.util
Class FileUtils
java.lang.Object
at.gv.egovernment.moaspss.util.FileUtils
Utility for accessing files on the file system, and for reading from input
streams.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic StringmakeAbsoluteURL(String url, String root) Returns the absolute URL of a given url which is relative to the parameter rootstatic byte[]Reads a file, given by filename, into a byte array.static StringReads a file, given by filename, into a String.static byte[]readResource(String name) Reads a file from a resource.static StringreadResource(String name, String encoding) Reads a file from a resource.static byte[]Reads a file, given by URL, into a byte array.static StringReads a file, given by URL, into a String.
-
Constructor Details
-
FileUtils
public FileUtils()
-
-
Method Details
-
readURL
Reads a file, given by URL, into a byte array.- Parameters:
urlString- file URL- Returns:
- file content
- Throws:
IOException- on any exception thrown
-
readURL
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
Reads a file, given by filename, into a byte array.- Parameters:
filename- filename- Returns:
- file content
- Throws:
IOException- on any exception thrown
-
readFile
Reads a file, given by filename, into a String.- Parameters:
filename- filenameencoding- character encoding- Returns:
- file content
- Throws:
IOException- on any exception thrown
-
readResource
Reads a file from a resource.- Parameters:
name- resource name- Returns:
- file content as a byte array
- Throws:
IOException- on any exception thrown
-
readResource
Reads a file from a resource.- Parameters:
name- filenameencoding- character encoding- Returns:
- file content
- Throws:
IOException- on any exception thrown
-
makeAbsoluteURL
Returns the absolute URL of a given url which is relative to the parameter root- Parameters:
url-root-- Returns:
- String
-
copyFile
-