Package pi.resources
Class ResourceLoader
java.lang.Object
pi.resources.ResourceLoader
Lädt Dateien aus der JAR oder dem aktuellen Arbeitsverzeichnis.
- Author:
- Niklas Keller
-
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamGets the specified file as InputStream from either a resource folder or the file system.static InputStreamGets the specified file as InputStream from either a resource folder or the file system.static URLgetLocation(String name) static byte[]static FileloadAsFile(String filename) static InputStreamloadAsStream(String filename) static StringReads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.static StringReads the specified file as String from either a resource folder or the file system.static StringReads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.static StringReads the specified file as String from either a resource folder or the file system.
-
Method Details
-
load
- Throws:
IOException
-
loadAsStream
- Throws:
IOException
-
loadAsFile
-
get
Gets the specified file as InputStream from either a resource folder or the file system.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
InputStream. - See Also:
-
get
Gets the specified file as InputStream from either a resource folder or the file system.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
InputStream. - See Also:
-
read
Reads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.- Parameters:
file- The path to the file.charset- The charset that is used to read the String from the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.
Since noCharsetis specified with this overload, the implementation uses UTF-8 by default.- Parameters:
file- The path to the file.- Returns:
- The contents of the specified file as
String
-
read
Reads the specified file as String from either a resource folder or the file system.- Parameters:
file- The path to the file.charset- The charset that is used to read the String from the file.- Returns:
- The contents of the specified file as
String
-
getLocation
-