public class FileUtils extends Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static File |
fileOrCopiedFromResource(File file,
String name,
Function<String,String> format)
Open the specified file or copy if from resources
|
static File |
fileOrCopiedFromResource(String name,
Function<String,String> fallback)
Open the specified file or copy if from resources
|
static <T> T |
loadConfig(File src,
Class<T> valueType)
Load the given YAML file into the given class
|
static void |
writeFile(File file,
char[] data)
Writes the given data to the specified file on disk
|
static void |
writeFile(String name,
char[] data)
Writes the given data to the specified file on disk
|
public static <T> T loadConfig(File src, Class<T> valueType) throws IOException
src - File to loadvalueType - Class to load file intoIOExceptionpublic static File fileOrCopiedFromResource(String name, Function<String,String> fallback) throws IOException
name - File and resource namefallback - Formatting callbackIOExceptionpublic static File fileOrCopiedFromResource(File file, String name, Function<String,String> format) throws IOException
file - File to openname - Name of the resource get if neededformat - Formatting callbackIOExceptionpublic static void writeFile(File file, char[] data) throws IOException
file - File to write todata - Data to write to the fileIOExceptionpublic static void writeFile(String name, char[] data) throws IOException
name - File path to write todata - Data to write to the fileIOExceptionCopyright © 2020 GeyserMC. All rights reserved.