Removed code is debugged code.
This commit is contained in:
parent
705c499911
commit
01d08fb191
@ -2,7 +2,6 @@ package com.iqser.red.service.redaction.v1.server.redaction.utils;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -20,38 +19,12 @@ public class ResourceLoader {
|
|||||||
if (resource == null) {
|
if (resource == null) {
|
||||||
throw new IllegalArgumentException("could not load classpath resource: " + classpathPath);
|
throw new IllegalArgumentException("could not load classpath resource: " + classpathPath);
|
||||||
}
|
}
|
||||||
try (InputStream is = resource.openStream();
|
try (BufferedReader br = new BufferedReader(new InputStreamReader(resource.openStream(), StandardCharsets.UTF_8))) {
|
||||||
InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
|
|
||||||
BufferedReader br = new BufferedReader(isr)) {
|
|
||||||
return br.lines().collect(Collectors.toSet());
|
return br.lines().collect(Collectors.toSet());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IllegalArgumentException("could not load classpath resource: " + classpathPath, 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user