X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Ftest%2FXmlFileLoader.java;h=176a0de9a48f1d87a7eebb4ac2e48a74b89cac6e;hp=e1331b1380935e86bad9fa962060e8c02210ce24;hb=d2d4cefa4d8d662554b7f2fc0b0dd568d0db1180;hpb=dbd3524a5cdd27dd49fd09f1cf4ff0ff40e85c5e diff --git a/opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java b/opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java index e1331b1380..176a0de9a4 100644 --- a/opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java +++ b/opendaylight/netconf/netconf-util/src/test/java/org/opendaylight/controller/netconf/util/test/XmlFileLoader.java @@ -10,11 +10,9 @@ package org.opendaylight.controller.netconf.util.test; import com.google.common.base.Charsets; import com.google.common.base.Preconditions; -import com.google.common.io.CharStreams; -import com.google.common.io.InputSupplier; +import com.google.common.io.ByteSource; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import javax.xml.parsers.ParserConfigurationException; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.util.xml.XmlUtil; @@ -51,17 +49,13 @@ public class XmlFileLoader { public static String fileToString(final String fileName) throws IOException { try (InputStream resourceAsStream = XmlFileLoader.class.getClassLoader().getResourceAsStream(fileName)) { Preconditions.checkNotNull(resourceAsStream); - - InputSupplier supplier = new InputSupplier() { + return new ByteSource() { @Override - public InputStream getInput() throws IOException { + public InputStream openStream() { return resourceAsStream; } - }; - - InputSupplier readerSupplier = CharStreams.newReaderSupplier(supplier, Charsets.UTF_8); + }.asCharSource(Charsets.UTF_8).read(); - return CharStreams.toString(readerSupplier); } }