diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/utils/ResourceLoader.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/utils/ResourceLoader.java index ca634306..5fc33bbd 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/utils/ResourceLoader.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/utils/ResourceLoader.java @@ -2,7 +2,6 @@ package com.iqser.red.service.redaction.v1.server.redaction.utils; import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.nio.charset.StandardCharsets; @@ -20,38 +19,12 @@ public class ResourceLoader { if (resource == null) { throw new IllegalArgumentException("could not load classpath resource: " + classpathPath); } - try (InputStream is = resource.openStream(); - InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); - BufferedReader br = new BufferedReader(isr)) { + try (BufferedReader br = new BufferedReader(new InputStreamReader(resource.openStream(), StandardCharsets.UTF_8))) { return br.lines().collect(Collectors.toSet()); } catch (IOException e) { throw new IllegalArgumentException("could not load classpath resource: " + classpathPath, e); } + } - - public String loadAsString(String classpathPath) { - URL resource = ResourceLoader.class.getClassLoader().getResource(classpathPath); - if (resource == null) { - throw new IllegalArgumentException("could not load classpath resource: " + classpathPath); - } - try (InputStream is = resource.openStream(); - InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); - BufferedReader br = new BufferedReader(isr)) { - StringBuilder sb = new StringBuilder(); - String str; - while ((str = br.readLine()) != null) { - sb.append(str).append("\n"); - } - return sb.toString(); - } catch (IOException e) { - throw new IllegalArgumentException("could not load classpath resource: " + classpathPath, e); - } - } -} - - - - - - +} \ No newline at end of file