java.lang.Object
net.foxgenesis.util.resource.ModuleResource
net.foxgenesis.util.resource.FormattedModuleResource
A class that points to a resource inside a module and implements methods to
read from it after formatting its data.
Properties to format are specified by using a regular expression:
\{\{(.*?)}}
- Author:
- Ashley
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.foxgenesis.util.resource.ModuleResource
asProperties, getModule, getResourcePath, readAllLines, readToString, toString, writeToFile
-
Constructor Details
-
FormattedModuleResource
public FormattedModuleResource(@NotNull @NotNull String module, @NotNull @NotNull String resource, @NotNull @NotNull Map<@NotNull String, @NotNull String> mappings) Create a newModuleResourcethat points to a specifiedresourceinside amodule.The specified
Mapwill be used to format all data in this resource.- Parameters:
module- - name of theModulecontaining the resourceresource- - absolute path to the resourcemappings- - aMapcontaining all the properties to format- Throws:
NullPointerException- If the module name, resource name or mappings are null
-
-
Method Details
-
openStream
Open anInputStreamto this resource.If the specified mappings is empty, this will operate the same as
ModuleResource.openStream(). Otherwise, all data in the stream will be read into a string and formatted with the specified mappings.- Overrides:
openStreamin classModuleResource- Returns:
- Returns an
InputStreamof this resource. - Throws:
IOException- If an I/O error occurs
-