亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? service.java

?? java1.6眾多例子參考
?? JAVA
字號:
/* * @(#)Service.java	1.7 05/12/30 *  * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */package com.sun.jmx.remote.util;import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.net.URL;import java.util.ArrayList;import java.util.Enumeration;import java.util.Iterator;import java.util.List;import java.util.NoSuchElementException;import java.util.Set;import java.util.TreeSet;import java.security.AccessController;import java.security.PrivilegedAction;/** * EXTRACTED FROM sun.misc.Service * A simple service-provider lookup mechanism.  A <i>service</i> is a * well-known set of intjavax.management.remoteerfaces and (usually abstract) classes.  A <i>service * provider</i> is a specific implementation of a service.  The classes in a * provider typically implement the interfaces and subclass the classes defined * in the service itself.  Service providers may be installed in an * implementation of the Java platform in the form of extensions, that is, jar * files placed into any of the usual extension directories.  Providers may * also be made available by adding them to the applet or application class * path or by some other platform-specific means. * * <p> In this lookup mechanism a service is represented by an interface or an * abstract class.  (A concrete class may be used, but this is not * recommended.)  A provider of a given service contains one or more concrete * classes that extend this <i>service class</i> with data and code specific to * the provider.  This <i>provider class</i> will typically not be the entire * provider itself but rather a proxy that contains enough information to * decide whether the provider is able to satisfy a particular request together * with code that can create the actual provider on demand.  The details of * provider classes tend to be highly service-specific; no single class or * interface could possibly unify them, so no such class has been defined.  The * only requirement enforced here is that provider classes must have a * zero-argument constructor so that they may be instantiated during lookup. * * <p> A service provider identifies itself by placing a provider-configuration * file in the resource directory <tt>META-INF/services</tt>.  The file's name * should consist of the fully-qualified name of the abstract service class. * The file should contain a list of fully-qualified concrete provider-class * names, one per line.  Space and tab characters surrounding each name, as * well as blank lines, are ignored.  The comment character is <tt>'#'</tt> * (<tt>0x23</tt>); on each line all characters following the first comment * character are ignored.  The file must be encoded in UTF-8. * * <p> If a particular concrete provider class is named in more than one * configuration file, or is named in the same configuration file more than * once, then the duplicates will be ignored.  The configuration file naming a * particular provider need not be in the same jar file or other distribution * unit as the provider itself.  The provider must be accessible from the same * class loader that was initially queried to locate the configuration file; * note that this is not necessarily the class loader that found the file. * * <p> <b>Example:</b> Suppose we have a service class named * <tt>java.io.spi.CharCodec</tt>.  It has two abstract methods: * * <pre> *   public abstract CharEncoder getEncoder(String encodingName); *   public abstract CharDecoder getDecoder(String encodingName); * </pre> * * Each method returns an appropriate object or <tt>null</tt> if it cannot * translate the given encoding.  Typical <tt>CharCodec</tt> providers will * support more than one encoding. * * <p> If <tt>sun.io.StandardCodec</tt> is a provider of the <tt>CharCodec</tt> * service then its jar file would contain the file * <tt>META-INF/services/java.io.spi.CharCodec</tt>.  This file would contain * the single line: * * <pre> *   sun.io.StandardCodec    # Standard codecs for the platform * </pre> * * To locate an encoder for a given encoding name, the internal I/O code would * do something like this: * * <pre> *   CharEncoder getEncoder(String encodingName) { *       Iterator ps = Service.providers(CharCodec.class); *       while (ps.hasNext()) { *           CharCodec cc = (CharCodec)ps.next(); *           CharEncoder ce = cc.getEncoder(encodingName); *           if (ce != null) *               return ce; *       } *       return null; *   } * </pre> * * The provider-lookup mechanism always executes in the security context of the * caller.  Trusted system code should typically invoke the methods in this * class from within a privileged security context. * */public final class Service {    private static final String prefix = "META-INF/services/";    private Service() { }    private static void fail(Class service, String msg, Throwable cause)	throws IllegalArgumentException    {	IllegalArgumentException sce	    = new IllegalArgumentException(service.getName() + ": " + msg);		throw (IllegalArgumentException) EnvHelp.initCause(sce, cause);    }    private static void fail(Class service, String msg)	throws IllegalArgumentException    {	throw new IllegalArgumentException(service.getName() + ": " + msg);    }    private static void fail(Class service, URL u, int line, String msg)	throws IllegalArgumentException    {	fail(service, u + ":" + line + ": " + msg);    }    /**     * Parse a single line from the given configuration file, adding the name     * on the line to both the names list and the returned set if and only if the name is     * not already a member of the returned set.     */    private static int parseLine(Class service, URL u, BufferedReader r, int lc,				 List names, Set returned)	throws IOException, IllegalArgumentException    {	String ln = r.readLine();	if (ln == null) {	    return -1;	}	int ci = ln.indexOf('#');	if (ci >= 0) ln = ln.substring(0, ci);	ln = ln.trim();	int n = ln.length();	if (n != 0) {	    if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))		fail(service, u, lc, "Illegal configuration-file syntax");	    if (!Character.isJavaIdentifierStart(ln.charAt(0)))		fail(service, u, lc, "Illegal provider-class name: " + ln);	    for (int i = 1; i < n; i++) {		char c = ln.charAt(i);		if (!Character.isJavaIdentifierPart(c) && (c != '.'))		    fail(service, u, lc, "Illegal provider-class name: " + ln);	    }	    if (!returned.contains(ln)) {		names.add(ln);		returned.add(ln);	    }	}	return lc + 1;    }    /**     * Parse the content of the given URL as a provider-configuration file.     *     * @param  service     *         The service class for which providers are being sought;     *         used to construct error detail strings     *     * @param  url     *         The URL naming the configuration file to be parsed     *     * @param  returned     *         A Set containing the names of provider classes that have already     *         been returned.  This set will be updated to contain the names     *         that will be yielded from the returned <tt>Iterator</tt>.     *     * @return A (possibly empty) <tt>Iterator</tt> that will yield the     *         provider-class names in the given configuration file that are     *         not yet members of the returned set     *     * @throws IllegalArgumentException     *         If an I/O error occurs while reading from the given URL, or     *         if a configuration-file format error is detected     */    private static Iterator parse(Class service, URL u, Set returned)	throws IllegalArgumentException    {	InputStream in = null;	BufferedReader r = null;	ArrayList names = new ArrayList();	try {	    in = u.openStream();	    r = new BufferedReader(new InputStreamReader(in, "utf-8"));	    int lc = 1;	    while ((lc = parseLine(service, u, r, lc, names, returned)) >= 0);	} catch (IOException x) {	    fail(service, ": " + x);	} finally {	    try {		if (r != null) r.close();		if (in != null) in.close();	    } catch (IOException y) {		fail(service, ": " + y);	    }	}	return names.iterator();    }    /**     * Private inner class implementing fully-lazy provider lookup     */    private static class LazyIterator implements Iterator {	Class service;	ClassLoader loader;	Enumeration configs = null;	Iterator pending = null;	Set returned = new TreeSet();	String nextName = null;	private LazyIterator(Class service, ClassLoader loader) {	    this.service = service;	    this.loader = loader;	}	public boolean hasNext() throws IllegalArgumentException {	    if (nextName != null) {		return true;	    }	    if (configs == null) {		try {		    String fullName = prefix + service.getName();		    if (loader == null)			configs = ClassLoader.getSystemResources(fullName);		    else			configs = loader.getResources(fullName);		} catch (IOException x) {		    fail(service, ": " + x);		}	    }	    while ((pending == null) || !pending.hasNext()) {		if (!configs.hasMoreElements()) {		    return false;		}		pending = parse(service, (URL)configs.nextElement(), returned);	    }	    nextName = (String)pending.next();	    return true;	}	public Object next() throws IllegalArgumentException {	    if (!hasNext()) {		throw new NoSuchElementException();	    }	    String cn = nextName;	    nextName = null;	    try {		return Class.forName(cn, true, loader).newInstance();	    } catch (ClassNotFoundException x) {		fail(service,		     "Provider " + cn + " not found");	    } catch (Exception x) {		fail(service,		     "Provider " + cn + " could not be instantiated: " + x,		     x);	    }	    return null;	/* This cannot happen */	}	public void remove() {	    throw new UnsupportedOperationException();	}    }    /**     * Locates and incrementally instantiates the available providers of a     * given service using the given class loader.     *     * <p> This method transforms the name of the given service class into a     * provider-configuration filename as described above and then uses the     * <tt>getResources</tt> method of the given class loader to find all     * available files with that name.  These files are then read and parsed to     * produce a list of provider-class names.  The iterator that is returned     * uses the given class loader to lookup and then instantiate each element     * of the list.     *     * <p> Because it is possible for extensions to be installed into a running     * Java virtual machine, this method may return different results each time     * it is invoked. <p>     *     * @param  service     *         The service's abstract service class     *     * @param  loader     *         The class loader to be used to load provider-configuration files     *         and instantiate provider classes, or <tt>null</tt> if the system     *         class loader (or, failing that the bootstrap class loader) is to     *         be used     *      * @return An <tt>Iterator</tt> that yields provider objects for the given     *         service, in some arbitrary order.  The iterator will throw a     *         <tt>IllegalArgumentException</tt> if a provider-configuration     *         file violates the specified format or if a provider class cannot     *         be found and instantiated.     *     * @throws IllegalArgumentException     *         If a provider-configuration file violates the specified format     *         or names a provider class that cannot be found and instantiated     *     */    public static Iterator providers(Class service, ClassLoader loader)	throws IllegalArgumentException    {	return new LazyIterator(service, loader);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本乱码高清不卡字幕| 日韩精品视频网| 久久精品水蜜桃av综合天堂| 欧美精品丝袜中出| 欧美午夜不卡在线观看免费| 91福利资源站| 欧美日韩一区成人| 色噜噜久久综合| 色呦呦日韩精品| 欧美综合一区二区| 欧美日韩综合在线免费观看| 欧美日韩综合在线| 91超碰这里只有精品国产| 日韩午夜在线影院| 国产日韩欧美制服另类| 国产精品免费观看视频| 亚洲欧美福利一区二区| 亚洲大片一区二区三区| 性做久久久久久免费观看| 日本成人中文字幕在线视频 | 日韩精品一区二区在线| 欧美成人午夜电影| 国产免费久久精品| 最新国产精品久久精品| 亚洲第一久久影院| 韩国女主播成人在线| 99久久婷婷国产综合精品| 在线观看一区二区视频| 欧美一级高清片在线观看| 欧美激情一区二区三区在线| 亚洲精品成a人| 麻豆精品一区二区综合av| 国产麻豆欧美日韩一区| 91麻豆福利精品推荐| 欧美一区二区三级| 国产精品久久夜| 五月天一区二区| 高清国产午夜精品久久久久久| 91国偷自产一区二区三区成为亚洲经典 | 欧洲精品在线观看| 一区在线播放视频| 丝袜美腿亚洲一区二区图片| 国产成+人+日韩+欧美+亚洲| 91国偷自产一区二区三区观看 | 一区二区三区在线看| 另类小说色综合网站| 91麻豆swag| 26uuu亚洲| 亚洲18色成人| 91在线视频免费观看| 精品国产sm最大网站| 亚洲国产中文字幕| 99在线精品视频| 日本一区二区三区久久久久久久久不| 亚洲成人在线网站| 91麻豆国产福利精品| 欧美韩国日本不卡| 久久国产日韩欧美精品| 欧美精品久久久久久久久老牛影院 | 欧美美女bb生活片| 亚洲伦理在线免费看| www.成人在线| 欧美国产日产图区| 国产精品白丝jk黑袜喷水| 日韩免费高清电影| 美女被吸乳得到大胸91| 欧美美女黄视频| 午夜激情久久久| 欧美午夜在线一二页| 一区二区免费在线| 色猫猫国产区一区二在线视频| 国产精品久久久99| 99r国产精品| 国产精品久久久久久一区二区三区| 国产一区在线精品| 久久久久亚洲综合| 激情成人午夜视频| 久久天堂av综合合色蜜桃网| 韩国欧美国产1区| 久久久99精品免费观看不卡| 国产乱国产乱300精品| 久久综合视频网| 成人午夜私人影院| 国产精品福利电影一区二区三区四区| 国产成人免费av在线| 国产精品美女久久久久av爽李琼| 国产麻豆午夜三级精品| 欧美韩国日本不卡| 色婷婷综合五月| 亚洲超碰精品一区二区| 日韩午夜精品电影| 国产成人夜色高潮福利影视| 国产精品久久久久久久浪潮网站| 91在线视频18| 日韩综合小视频| 久久综合久久综合久久| 91在线观看成人| 亚洲一本大道在线| 精品国产成人系列| 97se亚洲国产综合自在线不卡| 亚洲线精品一区二区三区八戒| 在线播放日韩导航| 成人免费三级在线| 亚洲国产精品久久人人爱 | 国产精品三级av在线播放| 成人激情视频网站| 丝袜国产日韩另类美女| 久久久精品人体av艺术| 欧日韩精品视频| 国产精品自在欧美一区| 亚洲黄色片在线观看| 精品国产三级a在线观看| 成人免费毛片片v| 免费视频最近日韩| 中文字幕字幕中文在线中不卡视频| 欧美欧美欧美欧美首页| 国产精品一品视频| 日韩综合一区二区| 亚洲日本一区二区| 26uuu国产电影一区二区| 91福利国产精品| 高清视频一区二区| 裸体在线国模精品偷拍| 亚洲一区在线播放| 精品国产一区二区精华| 欧美日韩午夜影院| 91小宝寻花一区二区三区| 九九国产精品视频| 午夜视频久久久久久| 亚洲欧美另类久久久精品2019| 日韩精品中文字幕一区二区三区 | 色综合久久中文综合久久97| 久久99最新地址| 日本伊人色综合网| 一区二区在线观看视频在线观看| 久久久久国产精品麻豆| 精品国产一区二区三区四区四 | 91蜜桃婷婷狠狠久久综合9色| 国产一区欧美日韩| 美女一区二区久久| 石原莉奈一区二区三区在线观看| 怡红院av一区二区三区| 亚洲欧美综合色| 亚洲视频一区在线| 国产精品你懂的在线欣赏| 久久九九国产精品| 国产欧美日韩在线看| 国产亚洲一区二区三区四区 | 中文字幕一区二区三区视频| 久久亚洲捆绑美女| 日本一区二区视频在线| 国产午夜精品美女毛片视频| 国产日韩欧美高清| 中文字幕巨乱亚洲| 国产精品久久久久永久免费观看| 久久久影院官网| 国产日韩欧美在线一区| 欧美激情资源网| 国产精品久久久久精k8| 亚洲欧美日韩小说| 亚洲亚洲人成综合网络| 日韩影院精彩在线| 久久成人羞羞网站| 国产麻豆精品在线观看| 成人av在线资源网站| 99精品欧美一区| 欧美福利视频一区| 精品精品国产高清a毛片牛牛| 久久免费偷拍视频| 亚洲视频资源在线| 爽爽淫人综合网网站| 久久99精品国产麻豆婷婷| 国产激情视频一区二区三区欧美 | 欧美色综合网站| 91精品国产一区二区三区 | 高清视频一区二区| 色av综合在线| 日韩午夜av一区| 中文字幕精品一区二区精品绿巨人 | 亚洲精品视频在线看| 日韩影院在线观看| 国产电影一区在线| 精品视频123区在线观看| 久久久久一区二区三区四区| 亚洲少妇屁股交4| 美洲天堂一区二卡三卡四卡视频| 成人午夜伦理影院| 欧美日韩精品欧美日韩精品一综合| 精品精品国产高清a毛片牛牛 | 国产精品18久久久| 在线观看不卡一区| 久久综合色8888| 亚洲成人激情av| 成人深夜视频在线观看| 欧美精品在线观看播放| 国产精品免费观看视频| 免费久久精品视频| 欧洲激情一区二区| 国产精品久线观看视频| 捆绑紧缚一区二区三区视频|