forked from UnlegitDqrk/unlegitlibrary
Small changes
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.finn.unlegitlibrary</groupId>
|
<groupId>me.finn.unlegitlibrary</groupId>
|
||||||
<artifactId>unlegitlibrary</artifactId>
|
<artifactId>unlegitlibrary</artifactId>
|
||||||
<version>1.5.8</version>
|
<version>1.5.9</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
@@ -27,6 +27,20 @@ public class FileUtils extends DefaultMethodsOverrider {
|
|||||||
return splitName[splitName.length - 1];
|
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) {
|
public static void deleteDirectoryRecursion(File file) {
|
||||||
if (file.exists() && file.isDirectory()) {
|
if (file.exists() && file.isDirectory()) {
|
||||||
File[] entries = file.listFiles();
|
File[] entries = file.listFiles();
|
||||||
|
Reference in New Issue
Block a user