Skip to content

Commit

Permalink
Merge pull request #54 from metanorma/issue/52
Browse files Browse the repository at this point in the history
Issue/52
  • Loading branch information
Intelligent2013 authored Sep 13, 2023
2 parents 735081a + b00b1b3 commit 598889d
Show file tree
Hide file tree
Showing 5 changed files with 834 additions and 7 deletions.
16 changes: 15 additions & 1 deletion src/main/java/org/metanorma/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

/**
*
Expand Down Expand Up @@ -54,7 +55,20 @@ public static InputStream getStreamFromResources(ClassLoader classLoader, String
}
return stream;
}


public static String getFileContentFromResources(String fileName) throws Exception {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
try (InputStream is = classLoader.getResourceAsStream(fileName)) {
if (is == null) {
System.out.println("Cannot get resource \"" + fileName + "\" from Jar file.");
return null;
}
try (InputStreamReader isr = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(isr)) {
return reader.lines().collect(Collectors.joining("\n"));
}
}
}
public static void FlushTempFolder(Path tmpfilepath) {
if (Files.exists(tmpfilepath)) {
//Files.deleteIfExists(tmpfilepath);
Expand Down
Loading

0 comments on commit 598889d

Please sign in to comment.