X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Ftest%2FXmlFileLoader.java;h=176a0de9a48f1d87a7eebb4ac2e48a74b89cac6e;hb=refs%2Fchanges%2F31%2F7831%2F8;hp=e1331b1380935e86bad9fa962060e8c02210ce24;hpb=92e4e7d21ba725fc6661d4a14d72352a4b5d1e67;p=controller.git 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); } }