|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
你精通任何一门语言就最强大。现在来看,java的市场比C#大,C#容易入手,比较简单,java比较难<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!--Generatedbyjavadoc(build1.4.2-rc)onFriJun1300:14:25PDT2003-->
<TITLE>
URLClassLoader(Java2PlatformSEv1.4.2)
</TITLE>
<METANAME="keywords"CONTENT="java.net.URLClassLoaderclass">
<METANAME="keywords"CONTENT="addURL()">
<METANAME="keywords"CONTENT="getURLs()">
<METANAME="keywords"CONTENT="findClass()">
<METANAME="keywords"CONTENT="definePackage()">
<METANAME="keywords"CONTENT="findResource()">
<METANAME="keywords"CONTENT="findResources()">
<METANAME="keywords"CONTENT="getPermissions()">
<METANAME="keywords"CONTENT="newInstance()">
<LINKREL="stylesheet"TYPE="text/CSS"HREF="../../stylesheet.css"TITLE="Style">
<SCRIPTtype="text/javascript">
functionwindowTitle()
{
parent.document.title="URLClassLoader(Java2PlatformSEv1.4.2)";
}
</SCRIPT>
</HEAD>
<BODYBGCOLOR="white">
<!--=========STARTOFTOPNAVBAR=======-->
<ANAME="navbar_top"><!----></A>
<AHREF="#skip-navbar_top"title="Skipnavigationlinks"></A>
<TABLEBORDER="0"WIDTH="100%"CELLPADDING="1"CELLSPACING="0"SUMMARY="">
<TR>
<TDCOLSPAN=3BGCOLOR="#EEEEFF"CLASS="NavBarCell1">
<ANAME="navbar_top_firstrow"><!----></A>
<TABLEBORDER="0"CELLPADDING="0"CELLSPACING="3"SUMMARY="">
<TRALIGN="center"VALIGN="top">
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../overview-summary.html"><FONTCLASS="NavBarFont1"><B>Overview</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="package-summary.html"><FONTCLASS="NavBarFont1"><B>Package</B></FONT></A></TD>
<TDBGCOLOR="#FFFFFF"CLASS="NavBarCell1Rev"><FONTCLASS="NavBarFont1Rev"><B>Class</B></FONT></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="class-use/URLClassLoader.html"><FONTCLASS="NavBarFont1"><B>Use</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="package-tree.html"><FONTCLASS="NavBarFont1"><B>Tree</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../deprecated-list.html"><FONTCLASS="NavBarFont1"><B>Deprecated</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../index-files/index-1.html"><FONTCLASS="NavBarFont1"><B>Index</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../help-doc.html"><FONTCLASS="NavBarFont1"><B>Help</B></FONT></A></TD>
</TR>
</TABLE>
</TD>
<TDALIGN="right"VALIGN="top"ROWSPAN=3><EM>
<b>Java<sup><fontsize=-2>TM</font></sup>2Platform<br>Std.Ed.v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TDBGCOLOR="white"CLASS="NavBarCell2"><FONTSIZE="-2">
<AHREF="../../java/net/URL.html"title="classinjava.net"><B>PREVCLASS</B></A>
<AHREF="../../java/net/URLConnection.html"title="classinjava.net"><B>NEXTCLASS</B></A></FONT></TD>
<TDBGCOLOR="white"CLASS="NavBarCell2"><FONTSIZE="-2">
<AHREF="../../index.html"target="_top"><B>FRAMES</B></A>
<AHREF="URLClassLoader.html"target="_top"><B>NOFRAMES</B></A>
<SCRIPTtype="text/javascript">
<!--
if(window==top){
document.writeln(<AHREF="../../allclasses-noframe.html"><B>AllClasses</B></A>);
}
//-->
</SCRIPT>
<NOSCRIPT>
<AHREF="../../allclasses-noframe.html"><B>AllClasses</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TDVALIGN="top"CLASS="NavBarCell3"><FONTSIZE="-2">
SUMMARY:NESTED|FIELD|<AHREF="#constructor_summary">CONSTR</A>|<AHREF="#method_summary">METHOD</A></FONT></TD>
<TDVALIGN="top"CLASS="NavBarCell3"><FONTSIZE="-2">
DETAIL:FIELD|<AHREF="#constructor_detail">CONSTR</A>|<AHREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<ANAME="skip-navbar_top"></A>
<!--=========ENDOFTOPNAVBAR=========-->
<HR>
<!--========STARTOFCLASSDATA========-->
<H2>
<FONTSIZE="-1">
java.net</FONT>
<BR>
ClassURLClassLoader</H2>
<PRE>
<AHREF="../../java/lang/Object.html"title="classinjava.lang">java.lang.Object</A>
<AHREF="../../java/security/SecureClassLoader.html"title="classinjava.security">java.security.SecureClassLoader</A>
<IMGSRC="http://www.163design.net/resources/inherit.gif"ALT="extendedby"><B>java.net.URLClassLoader</B>
</PRE>
<HR>
<DL>
<DT>publicclass<B>URLClassLoader</B><DT>extends<AHREF="../../java/security/SecureClassLoader.html"title="classinjava.security">SecureClassLoader</A></DL>
<P>
Thisclassloaderisusedtoloadclassesandresourcesfromasearch
pathofURLsreferringtobothJARfilesanddirectories.AnyURLthat
endswitha/isassumedtorefertoadirectory.Otherwise,theURL
isassumedtorefertoaJARfilewhichwillbeopenedasneeded.
这个类加载器用于从指向JAR文件和目次的URL搜刮路径中加载类和资本。任何故“/”停止的URL被以为是指向目次的,
不然,URL被以为指向必要翻开的JAR文件。
<p>
TheAccessControlContextofthethreadthatcreatedtheinstanceof
URLClassLoaderwillbeusedwhensubsequentlyloadingclassesand
resources.
当加载类和资本时,利用创立URLClassLoader实例的线程的AccessControlContext。
<p>
Theclassesthatareloadedarebydefaultgrantedpermissiononlyto
accesstheURLsspecifiedwhentheURLClassLoaderwascreated.
被加载的类在默许情形下,是被受权只能会见在创立URLClassLoader类时指定的URL。
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
<HR>
<P>
<!--========NESTEDCLASSSUMMARY========-->
<!--===========FIELDSUMMARY===========-->
<!--========CONSTRUCTORSUMMARY========-->
<ANAME="constructor_summary"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#CCCCFF"CLASS="TableHeadingColor">
<TDCOLSPAN=2><FONTSIZE="+2">
<B>ConstructorSummary</B></FONT></TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[])">URLClassLoader</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls)</CODE>
<BR>
ConstructsanewURLClassLoaderforthespecifiedURLsusingthe
defaultdelegationparent<code>ClassLoader</code>.
利用默许的代办署理父ClassLoader机关一个指定URL的新的URLClassLoader。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[],java.lang.ClassLoader)">URLClassLoader</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent)</CODE>
<BR>
ConstructsanewURLClassLoaderforthegivenURLs.
机关一个指定URL的新的URLClassLoader。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#URLClassLoader(java.net.URL[],java.lang.ClassLoader,java.net.URLStreamHandlerFactory)">URLClassLoader</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent,
<AHREF="../../java/net/URLStreamHandlerFactory.html"title="interfaceinjava.net">URLStreamHandlerFactory</A>factory)</CODE>
<BR>
ConstructsanewURLClassLoaderforthespecifiedURLs,parent
classloader,andURLStreamHandlerFactory.
机关一个指定URL、父类加载器和URLStreamHandlerFactory的新的URLClassLoader。</TD>
</TR>
</TABLE>
<!--==========METHODSUMMARY===========-->
<ANAME="method_summary"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#CCCCFF"CLASS="TableHeadingColor">
<TDCOLSPAN=2><FONTSIZE="+2">
<B>MethodSummary</B></FONT></TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>protectedvoid</CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#addURL(java.net.URL)">addURL</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>url)</CODE>
<BR>
AppendsthespecifiedURLtothelistofURLstosearchfor
classesandresources.
在用于搜刮类和资本的URL列表中增加指定的URL。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>protected<AHREF="../../java/lang/Package.html"title="classinjava.lang">Package</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#definePackage(java.lang.String,java.util.jar.Manifest,java.net.URL)">definePackage</A></B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name,
<AHREF="../../java/util/jar/Manifest.html"title="classinjava.util.jar">Manifest</A>man,
<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>url)</CODE>
<BR>
DefinesanewpackagebynameinthisClassLoader.
在此类加载器顶用称号界说新的包。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>protected<AHREF="../../java/lang/Class.html"title="classinjava.lang">Class</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#findClass(java.lang.String)">findClass</A></B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)</CODE>
<BR>
FindsandloadstheclasswiththespecifiednamefromtheURLsearch
path.
从URL搜刮路径查找并加载指命名称的类。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE><AHREF="../../java/net/URL.html"title="classinjava.net">URL</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#findResource(java.lang.String)">findResource</A></B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)</CODE>
<BR>
FindstheresourcewiththespecifiednameontheURLsearchpath.
从URL搜刮路径查找并加载指命名称的资本。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE><AHREF="../../java/util/Enumeration.html"title="interfaceinjava.util">Enumeration</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#findResources(java.lang.String)">findResources</A></B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)</CODE>
<BR>
ReturnsanEnumerationofURLsrepresentingalloftheresources
ontheURLsearchpathhavingthespecifiedname.
前往含指命名称的URL搜刮路径的一切资本的URL暗示的列举。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>protected<AHREF="../../java/security/PermissionCollection.html"title="classinjava.security">PermissionCollection</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#getPermissions(java.security.CodeSource)">getPermissions</A></B>(<AHREF="../../java/security/CodeSource.html"title="classinjava.security">CodeSource</A>codesource)</CODE>
<BR>
Returnsthepermissionsforthegivencodesourceobject.
前往给定代码资本对象的允许。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE><AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]</CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#getURLs()">getURLs</A></B>()</CODE>
<BR>
ReturnsthesearchpathofURLsforloadingclassesandresources.
前往用于加载类和资本的URL搜刮路径。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>static<AHREF="../../java/net/URLClassLoader.html"title="classinjava.net">URLClassLoader</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#newInstance(java.net.URL[])">newInstance</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls)</CODE>
<BR>
CreatesanewinstanceofURLClassLoaderforthespecified
URLsanddefaultparentclassloader.
创立一个利用指定URL和默许父类加载器的URLClassLoader实例。</TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TDALIGN="right"VALIGN="top"WIDTH="1%"><FONTSIZE="-1">
<CODE>static<AHREF="../../java/net/URLClassLoader.html"title="classinjava.net">URLClassLoader</A></CODE></FONT></TD>
<TD><CODE><B><AHREF="../../java/net/URLClassLoader.html#newInstance(java.net.URL[],java.lang.ClassLoader)">newInstance</A></B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent)</CODE>
<BR>
CreatesanewinstanceofURLClassLoaderforthespecified
URLsandparentclassloader.
创立一个利用指定URL和父类加载器的URLClassLoader实例。</TD>
</TR>
</TABLE>
<ANAME="methods_inherited_from_class_java.security.SecureClassLoader"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#EEEEFF"CLASS="TableSubHeadingColor">
<TD><B>Methodsinheritedfromclassjava.security.<AHREF="../../java/security/SecureClassLoader.html"title="classinjava.security">SecureClassLoader</A></B></TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><AHREF="../../java/security/SecureClassLoader.html#defineClass(java.lang.String,byte[],int,int,java.security.CodeSource)">defineClass</A></CODE></TD>
</TR>
</TABLE>
<ANAME="methods_inherited_from_class_java.lang.ClassLoader"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#EEEEFF"CLASS="TableSubHeadingColor">
<TD><B>Methodsinheritedfromclassjava.lang.<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A></B></TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><AHREF="../../java/lang/ClassLoader.html#clearAssertionStatus()">clearAssertionStatus</A>,<AHREF="../../java/lang/ClassLoader.html#defineClass(byte[],int,int)">defineClass</A>,<AHREF="../../java/lang/ClassLoader.html#defineClass(java.lang.String,byte[],int,int)">defineClass</A>,<AHREF="../../java/lang/ClassLoader.html#defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)">defineClass</A>,<AHREF="../../java/lang/ClassLoader.html#definePackage(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.net.URL)">definePackage</A>,<AHREF="../../java/lang/ClassLoader.html#findLibrary(java.lang.String)">findLibrary</A>,<AHREF="../../java/lang/ClassLoader.html#findLoadedClass(java.lang.String)">findLoadedClass</A>,<AHREF="../../java/lang/ClassLoader.html#findSystemClass(java.lang.String)">findSystemClass</A>,<AHREF="../../java/lang/ClassLoader.html#getPackage(java.lang.String)">getPackage</A>,<AHREF="../../java/lang/ClassLoader.html#getPackages()">getPackages</A>,<AHREF="../../java/lang/ClassLoader.html#getParent()">getParent</A>,<AHREF="../../java/lang/ClassLoader.html#getResource(java.lang.String)">getResource</A>,<AHREF="../../java/lang/ClassLoader.html#getResourceAsStream(java.lang.String)">getResourceAsStream</A>,<AHREF="../../java/lang/ClassLoader.html#getResources(java.lang.String)">getResources</A>,<AHREF="../../java/lang/ClassLoader.html#getSystemClassLoader()">getSystemClassLoader</A>,<AHREF="../../java/lang/ClassLoader.html#getSystemResource(java.lang.String)">getSystemResource</A>,<AHREF="../../java/lang/ClassLoader.html#getSystemResourceAsStream(java.lang.String)">getSystemResourceAsStream</A>,<AHREF="../../java/lang/ClassLoader.html#getSystemResources(java.lang.String)">getSystemResources</A>,<AHREF="../../java/lang/ClassLoader.html#loadClass(java.lang.String)">loadClass</A>,<AHREF="../../java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">loadClass</A>,<AHREF="../../java/lang/ClassLoader.html#resolveClass(java.lang.Class)">resolveClass</A>,<AHREF="../../java/lang/ClassLoader.html#setClassAssertionStatus(java.lang.String,boolean)">setClassAssertionStatus</A>,<AHREF="../../java/lang/ClassLoader.html#setDefaultAssertionStatus(boolean)">setDefaultAssertionStatus</A>,<AHREF="../../java/lang/ClassLoader.html#setPackageAssertionStatus(java.lang.String,boolean)">setPackageAssertionStatus</A>,<AHREF="../../java/lang/ClassLoader.html#setSigners(java.lang.Class,java.lang.Object[])">setSigners</A></CODE></TD>
</TR>
</TABLE>
<ANAME="methods_inherited_from_class_java.lang.Object"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#EEEEFF"CLASS="TableSubHeadingColor">
<TD><B>Methodsinheritedfromclassjava.lang.<AHREF="../../java/lang/Object.html"title="classinjava.lang">Object</A></B></TD>
</TR>
<TRBGCOLOR="white"CLASS="TableRowColor">
<TD><CODE><AHREF="../../java/lang/Object.html#clone()">clone</A>,<AHREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>,<AHREF="../../java/lang/Object.html#finalize()">finalize</A>,<AHREF="../../java/lang/Object.html#getClass()">getClass</A>,<AHREF="../../java/lang/Object.html#hashCode()">hashCode</A>,<AHREF="../../java/lang/Object.html#notify()">notify</A>,<AHREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>,<AHREF="../../java/lang/Object.html#toString()">toString</A>,<AHREF="../../java/lang/Object.html#wait()">wait</A>,<AHREF="../../java/lang/Object.html#wait(long)">wait</A>,<AHREF="../../java/lang/Object.html#wait(long,int)">wait</A></CODE></TD>
</TR>
</TABLE>
<P>
<!--============FIELDDETAIL===========-->
<!--=========CONSTRUCTORDETAIL========-->
<ANAME="constructor_detail"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#CCCCFF"CLASS="TableHeadingColor">
<TDCOLSPAN=1><FONTSIZE="+2">
<B>ConstructorDetail</B></FONT></TD>
</TR>
</TABLE>
<ANAME="URLClassLoader(java.net.URL[],java.lang.ClassLoader)"><!----></A><H3>
URLClassLoader</H3>
<PRE>
public<B>URLClassLoader</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent)</PRE>
<DL>
<DD>ConstructsanewURLClassLoaderforthegivenURLs.TheURLswillbe
searchedintheorderspecifiedforclassesandresourcesafterfirst
searchinginthespecifiedparentclassloader.AnyURLthatendswith
a/isassumedtorefertoadirectory.Otherwise,theURLisassumed
torefertoaJARfilewhichwillbedownloadedandopenedasneeded.
机关一个指定URL的新的URLClassLoader。起首在父类加载器搜刮后,以指定的类和资本的按次搜刮URL。
任何故“/”停止的URL被以为是指向目次的,不然,URL被以为指向被下载且必要翻开的JAR文件。
<p>Ifthereisasecuritymanager,thismethodfirst
callsthesecuritymanagers<code>checkCreateClassLoader</code>method
toensurecreationofaclassloaderisallowed.
假如存在平安办理器,该办法起首挪用平安办理器的checkCreateClassLoader办法以确认创立类加载器被同意。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE>-theURLsfromwhichtoloadclassesandresources
从其处加载类和资本的URL<DD><CODE>parent</CODE>-theparentclassloaderfordelegation
代办署理的父类加载器
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/lang/SecurityException.html"title="classinjava.lang">SecurityException</A></CODE>-ifasecuritymanagerexistsandits
<code>checkCreateClassLoader</code>methoddoesntallow
creationofaclassloader.
假如平安办理存在,它的checkCreateClassLoader办法不同意创立类加载器时抛出<DT><B>SeeAlso:</B><DD><AHREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<HR>
<ANAME="URLClassLoader(java.net.URL[])"><!----></A><H3>
URLClassLoader</H3>
<PRE>
public<B>URLClassLoader</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls)</PRE>
<DL>
<DD>ConstructsanewURLClassLoaderforthespecifiedURLsusingthe
defaultdelegationparent<code>ClassLoader</code>.TheURLswill
besearchedintheorderspecifiedforclassesandresourcesafter
firstsearchingintheparentclassloader.AnyURLthatendswith
a/isassumedtorefertoadirectory.Otherwise,theURLis
assumedtorefertoaJARfilewhichwillbedownloadedandopened
asneeded.
利用默许的代办署理父ClassLoader机关一个指定URL的新的URLClassLoader。起首在父类加载器搜刮后,以指定的类和资本的按次搜刮URL。
任何故“/”停止的URL被以为是指向目次的,不然,URL被以为指向被下载且必要翻开的JAR文件。
<p>Ifthereisasecuritymanager,thismethodfirst
callsthesecuritymanagers<code>checkCreateClassLoader</code>method
toensurecreationofaclassloaderisallowed.
假如存在平安办理器,该办法起首挪用平安办理器的checkCreateClassLoader办法以确认创立类加载器被同意。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE>-theURLsfromwhichtoloadclassesandresources
从其处加载类和资本的URL
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/lang/SecurityException.html"title="classinjava.lang">SecurityException</A></CODE>-ifasecuritymanagerexistsandits
<code>checkCreateClassLoader</code>methoddoesntallow
creationofaclassloader.
假如平安办理存在,它的checkCreateClassLoader办法不同意创立类加载器时抛出<DT><B>SeeAlso:</B><DD><AHREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<HR>
<ANAME="URLClassLoader(java.net.URL[],java.lang.ClassLoader,java.net.URLStreamHandlerFactory)"><!----></A><H3>
URLClassLoader</H3>
<PRE>
public<B>URLClassLoader</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent,
<AHREF="../../java/net/URLStreamHandlerFactory.html"title="interfaceinjava.net">URLStreamHandlerFactory</A>factory)</PRE>
<DL>
<DD>ConstructsanewURLClassLoaderforthespecifiedURLs,parent
classloader,andURLStreamHandlerFactory.Theparentargument
willbeusedastheparentclassloaderfordelegation.The
factoryargumentwillbeusedasthestreamhandlerfactoryto
obtainprotocolhandlerswhencreatingnewURLs.
机关一个指定URL、父类加载器和URLStreamHandlerFactory的新的URLClassLoader。
parent参数用作代办署理的父类加载器。factory参数用作当创立新的URL时取得协定句柄的流句柄工场。
<p>Ifthereisasecuritymanager,thismethodfirst
callsthesecuritymanagers<code>checkCreateClassLoader</code>method
toensurecreationofaclassloaderisallowed.
假如存在平安办理器,该办法起首挪用平安办理器的checkCreateClassLoader办法以确认创立类加载器被同意。
<P>
<DT><B>Parameters:</B><DD><CODE>urls</CODE>-theURLsfromwhichtoloadclassesandresources
从其处加载类和资本的URL<DD><CODE>parent</CODE>-theparentclassloaderfordelegation
代办署理的父类加载器<DD><CODE>factory</CODE>-theURLStreamHandlerFactorytousewhencreatingURLs
在创立URL时利用的URLStreamHandlerFactory
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/lang/SecurityException.html"title="classinjava.lang">SecurityException</A></CODE>-ifasecuritymanagerexistsandits
<code>checkCreateClassLoader</code>methoddoesntallow
creationofaclassloader.
假如平安办理存在,它的checkCreateClassLoader办法不同意创立类加载器时抛出<DT><B>SeeAlso:</B><DD><AHREF="../../java/lang/SecurityManager.html#checkCreateClassLoader()"><CODE>SecurityManager.checkCreateClassLoader()</CODE></A></DL>
<!--============METHODDETAIL==========-->
<ANAME="method_detail"><!----></A>
<TABLEBORDER="1"WIDTH="100%"CELLPADDING="3"CELLSPACING="0"SUMMARY="">
<TRBGCOLOR="#CCCCFF"CLASS="TableHeadingColor">
<TDCOLSPAN=1><FONTSIZE="+2">
<B>MethodDetail</B></FONT></TD>
</TR>
</TABLE>
<ANAME="addURL(java.net.URL)"><!----></A><H3>
addURL</H3>
<PRE>
protectedvoid<B>addURL</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>url)</PRE>
<DL>
<DD>AppendsthespecifiedURLtothelistofURLstosearchfor
classesandresources.
在用于搜刮类和资本的URL列表中增加指定的URL。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE>-theURLtobeaddedtothesearchpathofURLs在URL搜刮路径中增加的URL</DL>
</DD>
</DL>
<HR>
<ANAME="getURLs()"><!----></A><H3>
getURLs</H3>
<PRE>
public<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]<B>getURLs</B>()</PRE>
<DL>
<DD>ReturnsthesearchpathofURLsforloadingclassesandresources.
ThisincludestheoriginallistofURLsspecifiedtotheconstructor,
alongwithanyURLssubsequentlyappendedbytheaddURL()method.
前往用于加载类和资本的URL搜刮路径。包含指定给机关函数的原始URL列表,及利用addURL()办法后增加的URL。
<P>
<DD><DL>
<DT><B>Returns:</B><DD>thesearchpathofURLsforloadingclassesandresources.用于加载类和资本的URL搜刮路径。</DL>
</DD>
</DL>
<HR>
<ANAME="findClass(java.lang.String)"><!----></A><H3>
findClass</H3>
<PRE>
protected<AHREF="../../java/lang/Class.html"title="classinjava.lang">Class</A><B>findClass</B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)
throws<AHREF="../../java/lang/ClassNotFoundException.html"title="classinjava.lang">ClassNotFoundException</A></PRE>
<DL>
<DD>FindsandloadstheclasswiththespecifiednamefromtheURLsearch
path.AnyURLsreferringtoJARfilesareloadedandopenedasneeded
untiltheclassisfound.
从URL搜刮路径查找并加载指命名称的类。加载指向JAR文件的URL并在必要时翻开直到找到类。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><AHREF="../../java/lang/ClassLoader.html#findClass(java.lang.String)">findClass</A></CODE>inclass<CODE><AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE>-thenameoftheclass类名
<DT><B>Returns:</B><DD>theresultingclass了局类
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/lang/ClassNotFoundException.html"title="classinjava.lang">ClassNotFoundException</A></CODE>-iftheclasscouldnotbefound假如找不到该类抛出</DL>
</DD>
</DL>
<HR>
<ANAME="definePackage(java.lang.String,java.util.jar.Manifest,java.net.URL)"><!----></A><H3>
definePackage</H3>
<PRE>
protected<AHREF="../../java/lang/Package.html"title="classinjava.lang">Package</A><B>definePackage</B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name,
<AHREF="../../java/util/jar/Manifest.html"title="classinjava.util.jar">Manifest</A>man,
<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>url)
throws<AHREF="../../java/lang/IllegalArgumentException.html"title="classinjava.lang">IllegalArgumentException</A></PRE>
<DL>
<DD>DefinesanewpackagebynameinthisClassLoader.Theattributes
containedinthespecifiedManifestwillbeusedtoobtainpackage
versionandsealinginformation.Forsealedpackages,theadditional
URLspecifiesthecodesourceURLfromwhichthepackagewasloaded.
在此类加载器顶用称号界说新的包。包括在指定的Manifest中的属性用于取得包版本和封装信息。
关于已封装包,附加URL指定来自加载的包的代码源URL。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE>-thepackagename
包名<DD><CODE>man</CODE>-theManifestcontainingpackageversionandsealing
information
包括包版本和封装信息的Manifest<DD><CODE>url</CODE>-thecodesourceurlforthepackage,ornullifnone
用于包的代码源url,假如没有则为null
<DT><B>Returns:</B><DD>thenewlydefinedPackageobject新界说的包对象
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/lang/IllegalArgumentException.html"title="classinjava.lang">IllegalArgumentException</A></CODE>-ifthepackagenameduplicates
anexistingpackageeitherinthisclassloaderorone
ofitsancestors
假如包同现有包不异,或在此类加器或其父辈之一时抛出</DL>
</DD>
</DL>
<HR>
<ANAME="findResource(java.lang.String)"><!----></A><H3>
findResource</H3>
<PRE>
public<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A><B>findResource</B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)</PRE>
<DL>
<DD>FindstheresourcewiththespecifiednameontheURLsearchpath.
从URL搜刮路径查找并加载指命名称的资本。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><AHREF="../../java/lang/ClassLoader.html#findResource(java.lang.String)">findResource</A></CODE>inclass<CODE><AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE>-thenameoftheresource资本名
<DT><B>Returns:</B><DD>a<code>URL</code>fortheresource,or<code>null</code>
iftheresourcecouldnotbefound.资本的URL,假如找不到该资本,前往null</DL>
</DD>
</DL>
<HR>
<ANAME="findResources(java.lang.String)"><!----></A><H3>
findResources</H3>
<PRE>
public<AHREF="../../java/util/Enumeration.html"title="interfaceinjava.util">Enumeration</A><B>findResources</B>(<AHREF="../../java/lang/String.html"title="classinjava.lang">String</A>name)
throws<AHREF="../../java/io/IOException.html"title="classinjava.io">IOException</A></PRE>
<DL>
<DD>ReturnsanEnumerationofURLsrepresentingalloftheresources
ontheURLsearchpathhavingthespecifiedname.
前往含指命名称的URL搜刮路径的一切资本的URL暗示的列举。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><AHREF="../../java/lang/ClassLoader.html#findResources(java.lang.String)">findResources</A></CODE>inclass<CODE><AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE>-theresourcename资本名
<DT><B>Returns:</B><DD>an<code>Enumeration</code>of<code>URL</code>sURL的列举
<DT><B>Throws:</B>
<DD><CODE><AHREF="../../java/io/IOException.html"title="classinjava.io">IOException</A></CODE>-ifanI/Oexceptionoccurs假如产生I/O非常抛出</DL>
</DD>
</DL>
<HR>
<ANAME="getPermissions(java.security.CodeSource)"><!----></A><H3>
getPermissions</H3>
<PRE>
protected<AHREF="../../java/security/PermissionCollection.html"title="classinjava.security">PermissionCollection</A><B>getPermissions</B>(<AHREF="../../java/security/CodeSource.html"title="classinjava.security">CodeSource</A>codesource)</PRE>
<DL>
<DD>Returnsthepermissionsforthegivencodesourceobject.
Theimplementationofthismethodfirstcallssuper.getPermissions
andthenaddspermissionsbasedontheURLofthecodesource.
前往给定代码资本对象的允许。此办法的完成起首挪用super.getPermissions,然后
增添基于代码源URL的允许。
<p>
Iftheprotocolis"file"
andthepathspecifiesafile,thenpermissiontoreadthat
fileisgranted.Ifprotocolis"file"andthepathis
adirectory,permissionisgrantedtoreadallfiles
and(recursively)allfilesandsubdirectoriescontainedin
thatdirectory.
假如协定为“file”且路径指定为一个文件,则授与读取此文件的允许。
假如协定为“file”且路径指定为一个目次,则授与读取此目次中包含子目次中一切文件的允许。
<p>
Iftheprotocolisnot"file",then
toconnecttoandacceptconnectionsfromtheURLshostisgranted.
假如协定不是“file”,则授与毗连到并被URL主机承受的允许。
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><AHREF="../../java/security/SecureClassLoader.html#getPermissions(java.security.CodeSource)">getPermissions</A></CODE>inclass<CODE><AHREF="../../java/security/SecureClassLoader.html"title="classinjava.security">SecureClassLoader</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>codesource</CODE>-thecodesource代码源
<DT><B>Returns:</B><DD>thepermissionsgrantedtothecodesource授与代码源的允许</DL>
</DD>
</DL>
<HR>
<ANAME="newInstance(java.net.URL[],java.lang.ClassLoader)"><!----></A><H3>
newInstance</H3>
<PRE>
publicstatic<AHREF="../../java/net/URLClassLoader.html"title="classinjava.net">URLClassLoader</A><B>newInstance</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls,
<AHREF="../../java/lang/ClassLoader.html"title="classinjava.lang">ClassLoader</A>parent)</PRE>
<DL>
<DD>CreatesanewinstanceofURLClassLoaderforthespecified
URLsandparentclassloader.Ifasecuritymanageris
installed,the<code>loadClass</code>methodoftheURLClassLoader
returnedbythismethodwillinvokethe
<code>SecurityManager.checkPackageAccess</code>methodbefore
loadingtheclass.
创立一个利用指定URL和父类加载器的URLClassLoader实例。假如装有平安办理器,
此办法前往的URLClassLoader的loadClass办法将在加载类前挪用SecurityManager.checkPackageAccess办法。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>urls</CODE>-theURLstosearchforclassesandresources用于类和资本搜刮的URL<DD><CODE>parent</CODE>-theparentclassloaderfordelegation
代办署理的父类加载器
<DT><B>Returns:</B><DD>theresultingclassloader了局类加载器</DL>
</DD>
</DL>
<HR>
<ANAME="newInstance(java.net.URL[])"><!----></A><H3>
newInstance</H3>
<PRE>
publicstatic<AHREF="../../java/net/URLClassLoader.html"title="classinjava.net">URLClassLoader</A><B>newInstance</B>(<AHREF="../../java/net/URL.html"title="classinjava.net">URL</A>[]urls)</PRE>
<DL>
<DD>CreatesanewinstanceofURLClassLoaderforthespecified
URLsanddefaultparentclassloader.Ifasecuritymanageris
installed,the<code>loadClass</code>methodoftheURLClassLoader
returnedbythismethodwillinvokethe
<code>SecurityManager.checkPackageAccess</code>before
loadingtheclass.
创立一个利用指定URL和默许父类加载器的URLClassLoader实例。假如装有平安办理器,
此办法前往的URLClassLoader的loadClass办法将在加载类前挪用SecurityManager.checkPackageAccess办法。
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>urls</CODE>-theURLstosearchforclassesandresources用于类和资本搜刮的URL
<DT><B>Returns:</B><DD>theresultingclassloader了局类加载器</DL>
</DD>
</DL>
<!--=========ENDOFCLASSDATA=========-->
<HR>
<!--=======STARTOFBOTTOMNAVBAR======-->
<ANAME="navbar_bottom"><!----></A>
<AHREF="#skip-navbar_bottom"title="Skipnavigationlinks"></A>
<TABLEBORDER="0"WIDTH="100%"CELLPADDING="1"CELLSPACING="0"SUMMARY="">
<TR>
<TDCOLSPAN=3BGCOLOR="#EEEEFF"CLASS="NavBarCell1">
<ANAME="navbar_bottom_firstrow"><!----></A>
<TABLEBORDER="0"CELLPADDING="0"CELLSPACING="3"SUMMARY="">
<TRALIGN="center"VALIGN="top">
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../overview-summary.html"><FONTCLASS="NavBarFont1"><B>Overview</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="package-summary.html"><FONTCLASS="NavBarFont1"><B>Package</B></FONT></A></TD>
<TDBGCOLOR="#FFFFFF"CLASS="NavBarCell1Rev"><FONTCLASS="NavBarFont1Rev"><B>Class</B></FONT></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="class-use/URLClassLoader.html"><FONTCLASS="NavBarFont1"><B>Use</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="package-tree.html"><FONTCLASS="NavBarFont1"><B>Tree</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../deprecated-list.html"><FONTCLASS="NavBarFont1"><B>Deprecated</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../index-files/index-1.html"><FONTCLASS="NavBarFont1"><B>Index</B></FONT></A></TD>
<TDBGCOLOR="#EEEEFF"CLASS="NavBarCell1"><AHREF="../../help-doc.html"><FONTCLASS="NavBarFont1"><B>Help</B></FONT></A></TD>
</TR>
</TABLE>
</TD>
<TDALIGN="right"VALIGN="top"ROWSPAN=3><EM>
<b>Java<sup><fontsize=-2>TM</font></sup>2Platform<br>Std.Ed.v1.4.2</b></EM>
</TD>
</TR>
<TR>
<TDBGCOLOR="white"CLASS="NavBarCell2"><FONTSIZE="-2">
<AHREF="../../java/net/URL.html"title="classinjava.net"><B>PREVCLASS</B></A>
<AHREF="../../java/net/URLConnection.html"title="classinjava.net"><B>NEXTCLASS</B></A></FONT></TD>
<TDBGCOLOR="white"CLASS="NavBarCell2"><FONTSIZE="-2">
<AHREF="../../index.html"target="_top"><B>FRAMES</B></A>
<AHREF="URLClassLoader.html"target="_top"><B>NOFRAMES</B></A>
<SCRIPTtype="text/javascript">
<!--
if(window==top){
document.writeln(<AHREF="../../allclasses-noframe.html"><B>AllClasses</B></A>);
}
//-->
</SCRIPT>
<NOSCRIPT>
<AHREF="../../allclasses-noframe.html"><B>AllClasses</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TDVALIGN="top"CLASS="NavBarCell3"><FONTSIZE="-2">
SUMMARY:NESTED|FIELD|<AHREF="#constructor_summary">CONSTR</A>|<AHREF="#method_summary">METHOD</A></FONT></TD>
<TDVALIGN="top"CLASS="NavBarCell3"><FONTSIZE="-2">
DETAIL:FIELD|<AHREF="#constructor_detail">CONSTR</A>|<AHREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<ANAME="skip-navbar_bottom"></A>
<!--========ENDOFBOTTOMNAVBAR=======-->
<HR>
<fontsize="-1"><ahref="Submit>http://java.sun.com/cgi-bin/bugreport.cgi">Submitabugorfeature</a><br>ForfurtherAPIreferenceanddeveloperdocumentation,see<ahref="../../../relnotes/devdocs-vs-specs.html">Java2SDKSEDeveloperDocumentation</a>.Thatdocumentationcontainsmoredetailed,developer-targeteddescriptions,withconceptualoverviews,definitionsofterms,workarounds,andworkingcodeexamples.<p>Copyright2003SunMicrosystems,Inc.Allrightsreserved.Useissubjectto<ahref="../../../relnotes/license.html">licenseterms</a>.Alsoseethe<ahref="documentation>http://java.sun.com/docs/redist.html">documentationredistributionpolicy</a>.</font>
</BODY>
</HTML>
但是对于JAVA技术类的学习,我觉得大课堂反而会影响自身独立思考的过程,因为上课的时候,老师讲课的速度很快为了不遗漏要点,通常会仔细的听, |
|