Small changes

This commit is contained in:
2024-12-26 15:59:39 +01:00
parent 422773784a
commit 3474aee155
2 changed files with 15 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
<groupId>me.finn.unlegitlibrary</groupId>
<artifactId>unlegitlibrary</artifactId>
<version>1.5.8</version>
<version>1.5.9</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>

View File

@@ -27,6 +27,20 @@ public class FileUtils extends DefaultMethodsOverrider {
return splitName[splitName.length - 1];
}
public static String readFileFromResource(String filePath) throws IOException {
StringBuilder content = new StringBuilder();
InputStream inputStream = FileUtils.class.getClassLoader().getResourceAsStream(filePath);
if (inputStream == null) throw new FileNotFoundException("Can not load resource: " + filePath);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = reader.readLine()) != null) content.append(line);
}
inputStream.close();
return content.toString();
}
public static void deleteDirectoryRecursion(File file) {
if (file.exists() && file.isDirectory()) {
File[] entries = file.listFiles();