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=bfd413d87f82ee3ffed67a141a980805950a0f06;hp=457dda3080fa48adb18e170ba1e36d01d10513f6;hpb=c0c97bdca0c42607e8034bc91f51edf96d9e72a9;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 457dda3080..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 @@ -8,23 +8,18 @@ package org.opendaylight.controller.netconf.util.test; +import com.google.common.base.Charsets; +import com.google.common.base.Preconditions; +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; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; -import com.google.common.base.Charsets; -import com.google.common.base.Preconditions; -import com.google.common.io.CharStreams; -import com.google.common.io.InputSupplier; - public class XmlFileLoader { public static NetconfMessage xmlFileToNetconfMessage(final String fileName) throws IOException, SAXException, @@ -54,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); } }