Package nl.rrd.wool.parser
Class WoolResourceFileLoader
- java.lang.Object
-
- nl.rrd.wool.parser.WoolResourceFileLoader
-
- All Implemented Interfaces:
WoolFileLoader
public class WoolResourceFileLoader extends Object implements WoolFileLoader
This WOOL file loader can load files from resources on the classpath. The files should be organized as language/speaker/dialogue-name.wool or language/speaker/dialogue-name.json. Example: en/robin/intro.woolThe files should be specified in project file "dialogues.json" in the root directory. This can automatically be generated at build time. It should be structured like:
{ "en": { "robin":[ "dialogue1.wool", "dialogue2.wool", "dialogue3.json" ] } }
-
-
Constructor Summary
Constructors Constructor Description WoolResourceFileLoader(String resourcePath)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<WoolFileDescription>listWoolFiles()Lists all WOOL files in the project.ReaderopenFile(WoolFileDescription descr)Opens the specified WOOL file.
-
-
-
Constructor Detail
-
WoolResourceFileLoader
public WoolResourceFileLoader(String resourcePath)
Constructs a new instance.- Parameters:
resourcePath- the resource path (without leading or trailing slash)
-
-
Method Detail
-
listWoolFiles
public List<WoolFileDescription> listWoolFiles() throws IOException
Description copied from interface:WoolFileLoaderLists all WOOL files in the project. The files should be dialogue files (.wool) or translation files (.json).- Specified by:
listWoolFilesin interfaceWoolFileLoader- Returns:
- the files
- Throws:
IOException- if a reading error occurs
-
openFile
public Reader openFile(WoolFileDescription descr) throws IOException
Description copied from interface:WoolFileLoaderOpens the specified WOOL file. This should be a dialogue file (.wool) or a translation file (.json).- Specified by:
openFilein interfaceWoolFileLoader- Parameters:
descr- the file description- Returns:
- the reader for the file
- Throws:
IOException- if the file cannot be opened
-
-