< prev index next >

src/java.base/share/classes/java/util/ServiceLoader.java

Print this page
rev 57116 : 8234147: Avoid looking up standard charsets in core libraries
Reviewed-by: alanb

*** 43,63 **** import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Stream; import java.util.stream.StreamSupport; import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; import jdk.internal.access.JavaLangAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.ServicesCatalog.ServiceProvider; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; - /** * A facility to load implementations of a service. * * <p> A <i>service</i> is a well-known interface or class for which zero, one, * or many service providers exist. A <i>service provider</i> (or just --- 43,64 ---- import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Stream; import java.util.stream.StreamSupport; + import sun.nio.cs.UTF_8; + import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; import jdk.internal.access.JavaLangAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.ServicesCatalog.ServiceProvider; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; /** * A facility to load implementations of a service. * * <p> A <i>service</i> is a well-known interface or class for which zero, one, * or many service providers exist. A <i>service provider</i> (or just
*** 1162,1172 **** try { URLConnection uc = u.openConnection(); uc.setUseCaches(false); try (InputStream in = uc.getInputStream(); BufferedReader r ! = new BufferedReader(new InputStreamReader(in, "utf-8"))) { int lc = 1; while ((lc = parseLine(u, r, lc, names)) >= 0); } } catch (IOException x) { --- 1163,1173 ---- try { URLConnection uc = u.openConnection(); uc.setUseCaches(false); try (InputStream in = uc.getInputStream(); BufferedReader r ! = new BufferedReader(new InputStreamReader(in, UTF_8.INSTANCE))) { int lc = 1; while ((lc = parseLine(u, r, lc, names)) >= 0); } } catch (IOException x) {
< prev index next >