Removed usage to IOUtils.toString (#8579)

Specifically the toString reading from inputstream.

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
This commit is contained in:
Hilbrand Bouwkamp
2020-09-25 20:46:14 +02:00
committed by GitHub
parent aa3f73d423
commit 1bc55a208b
13 changed files with 46 additions and 43 deletions

View File

@@ -15,7 +15,6 @@ package org.openhab.binding.tplinksmarthome.internal.model;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.IOUtils;
import org.eclipse.jdt.annotation.NonNullByDefault;
import com.google.gson.Gson;
@@ -58,8 +57,7 @@ public final class ModelTestUtil {
* @throws IOException when file could not be read.
*/
public static String readJson(String filename) throws IOException {
return IOUtils
.toString(ModelTestUtil.class.getResourceAsStream(filename + ".json"), StandardCharsets.UTF_8.name())
.replaceAll("[\n\r\t ]", "");
return new String(ModelTestUtil.class.getResourceAsStream(filename + ".json").readAllBytes(),
StandardCharsets.UTF_8).replaceAll("[\n\r\t ]", "");
}
}