Sdílet prostřednictvím


URLClassLoader Class

Definition

This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories.

[Android.Runtime.Register("java/net/URLClassLoader", DoNotGenerateAcw=true)]
public class URLClassLoader : Java.Security.SecureClassLoader, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ICloseable
[<Android.Runtime.Register("java/net/URLClassLoader", DoNotGenerateAcw=true)>]
type URLClassLoader = class
    inherit SecureClassLoader
    interface ICloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Attributes
Implements

Remarks

This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories. Any URL that ends with a '/' is assumed to refer to a directory. Otherwise, the URL is assumed to refer to a JAR file which will be opened as needed.

The AccessControlContext of the thread that created the instance of URLClassLoader will be used when subsequently loading classes and resources.

The classes that are loaded are by default granted permission only to access the URLs specified when the URLClassLoader was created.

Added in 1.2.

Java documentation for java.net.URLClassLoader.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

URLClassLoader(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

URLClassLoader(URL[], ClassLoader, IURLStreamHandlerFactory)

Constructs a new URLClassLoader for the specified URLs, parent class loader, and URLStreamHandlerFactory.

URLClassLoader(URL[], ClassLoader)

Constructs a new URLClassLoader for the given URLs.

URLClassLoader(URL[])

Constructs a new URLClassLoader for the specified URLs using the default delegation parent ClassLoader.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Parent

Returns the parent class loader for delegation.

(Inherited from ClassLoader)
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AddURL(URL)

Appends the specified URL to the list of URLs to search for classes and resources.

ClearAssertionStatus()

Sets the default assertion status for this class loader to false and discards any package defaults or class assertion status settings associated with the class loader.

(Inherited from ClassLoader)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Closes this URLClassLoader, so that it can no longer be used to load new classes or resources that are defined by this loader.

DefineClass(Byte[], Int32, Int32)
Obsolete.

Converts an array of bytes into an instance of class Class.

(Inherited from ClassLoader)
DefineClass(String, Byte[], Int32, Int32, CodeSource)

Converts an array of bytes into an instance of class Class, with an optional CodeSource.

(Inherited from SecureClassLoader)
DefineClass(String, Byte[], Int32, Int32, ProtectionDomain)

Converts an array of bytes into an instance of class Class, with an optional ProtectionDomain.

(Inherited from ClassLoader)
DefineClass(String, Byte[], Int32, Int32)

Converts an array of bytes into an instance of class Class.

(Inherited from ClassLoader)
DefineClass(String, ByteBuffer, CodeSource)

Converts a java.nio.ByteBuffer ByteBuffer into an instance of class Class, with an optional CodeSource.

(Inherited from SecureClassLoader)
DefineClass(String, ByteBuffer, ProtectionDomain)

Converts a java.nio.ByteBuffer <tt>ByteBuffer</tt> into an instance of class Class, with an optional ProtectionDomain.

(Inherited from ClassLoader)
DefinePackage(String, Manifest, URL)

Defines a new package by name in this ClassLoader.

DefinePackage(String, String, String, String, String, String, String, URL)

Defines a package by name in this ClassLoader.

(Inherited from ClassLoader)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FindClass(String)

Finds the class with the specified binary name.

(Inherited from ClassLoader)
FindLibrary(String)

Returns the absolute path name of a native library.

(Inherited from ClassLoader)
FindLoadedClass(String)

Returns the class with the given binary name if this loader has been recorded by the Java virtual machine as an initiating loader of a class with that binary name.

(Inherited from ClassLoader)
FindResource(String)

Finds the resource with the specified name on the URL search path.

FindResources(String)

Returns an Enumeration of URLs representing all of the resources on the URL search path having the specified name.

FindSystemClass(String)

Finds a class with the specified binary name, loading it if necessary.

(Inherited from ClassLoader)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetPackage(String)

Returns a Package that has been defined by this class loader or any of its ancestors.

(Inherited from ClassLoader)
GetPackages()

Returns all of the Packages defined by this class loader and its ancestors.

(Inherited from ClassLoader)
GetPermissions(CodeSource)

Returns the permissions for the given CodeSource object.

(Inherited from SecureClassLoader)
GetResource(String)

Finds the resource with the given name.

(Inherited from ClassLoader)
GetResourceAsStream(String)

Returns an input stream for reading the specified resource.

(Inherited from ClassLoader)
GetResources(String)

Finds all the resources with the given name.

(Inherited from ClassLoader)
GetURLs()

Returns the search path of URLs for loading classes and resources.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
LoadClass(String, Boolean)

Loads the class with the specified binary name.

(Inherited from ClassLoader)
LoadClass(String)

Loads the class with the specified binary name.

(Inherited from ClassLoader)
LoadClassAsync(String, Boolean) (Inherited from ClassLoader)
LoadClassAsync(String) (Inherited from ClassLoader)
NewInstance(URL[], ClassLoader)

Creates a new instance of URLClassLoader for the specified URLs and parent class loader.

NewInstance(URL[])

Creates a new instance of URLClassLoader for the specified URLs and default parent class loader.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
ResolveClass(Class)

Links the specified class.

(Inherited from ClassLoader)
SetClassAssertionStatus(String, Boolean)

Sets the desired assertion status for the named top-level class in this class loader and any nested classes contained therein.

(Inherited from ClassLoader)
SetDefaultAssertionStatus(Boolean)

Sets the default assertion status for this class loader.

(Inherited from ClassLoader)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPackageAssertionStatus(String, Boolean)

Sets the package default assertion status for the named package.

(Inherited from ClassLoader)
SetSigners(Class, Object[])

Sets the signers of a class.

(Inherited from ClassLoader)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to