Package emu.grasscutter.data
Class DataLoader
java.lang.Object
emu.grasscutter.data.DataLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic InputStreamLoad a data file by its name.static InputStreamLoad a data file by its name.static <T> Tstatic <T> List<T>static <T1,T2> Map<T1, T2> static InputStreamReaderloadReader(String resourcePath) Creates an input stream reader for a data file.static <T> List<T>loadTableToList(String resourcePath, Class<T> classType)
-
Constructor Details
-
DataLoader
public DataLoader()
-
-
Method Details
-
load
Load a data file by its name. If the file isn't found within the /data directory then it will fallback to the default within the jar resources- Parameters:
resourcePath- The path to the data file to be loaded.- Returns:
- InputStream of the data file.
- Throws:
FileNotFoundException- See Also:
-
loadReader
public static InputStreamReader loadReader(String resourcePath) throws IOException, FileNotFoundException Creates an input stream reader for a data file. If the file isn't found within the /data directory then it will fallback to the default within the jar resources- Parameters:
resourcePath- The path to the data file to be loaded.- Returns:
- InputStreamReader of the data file.
- Throws:
IOExceptionFileNotFoundException- See Also:
-
load
public static InputStream load(String resourcePath, boolean useFallback) throws FileNotFoundException Load a data file by its name.- Parameters:
resourcePath- The path to the data file to be loaded.useFallback- If the file does not exist in the /data directory, should it use the default file in the jar?- Returns:
- InputStream of the data file.
- Throws:
FileNotFoundException
-
loadClass
- Throws:
IOException
-
loadList
- Throws:
IOException
-
loadMap
public static <T1,T2> Map<T1,T2> loadMap(String resourcePath, Class<T1> keyType, Class<T2> valueType) throws IOException - Throws:
IOException
-
loadTableToList
public static <T> List<T> loadTableToList(String resourcePath, Class<T> classType) throws IOException - Throws:
IOException
-
checkAllFiles
public static void checkAllFiles()
-