* #### CodeSource
public CodeSource([URL](../../java/net/URL.html "class in java.net") url,
[Certificate](../../java/security/cert/Certificate.html "class in java.security.cert")[] certs)
Constructs a CodeSource and associates it with the specified location and set of certificates.
Parameters:
`url` \- the location (URL). It may be `null`.
`certs` \- the certificate(s). It may be `null`. The contents of the array are copied to protect against subsequent modification.
* #### CodeSource
public CodeSource([URL](../../java/net/URL.html "class in java.net") url,
[CodeSigner](../../java/security/CodeSigner.html "class in java.security")[] signers)
Constructs a CodeSource and associates it with the specified location and set of code signers.
Parameters:
`url` \- the location (URL). It may be `null`.
`signers` \- the code signers. It may be `null`. The contents of the array are copied to protect against subsequent modification.
Since:
1.5
Method Detail
* #### hashCode
public int hashCode()
Returns the hash code value for this object.
Overrides:
`[hashCode](../../java/lang/Object.html#hashCode--)` in class `[Object](../../java/lang/Object.html "class in java.lang")`
Returns:
a hash code value for this object.
See Also:
[Object.equals(java.lang.Object)](../../java/lang/Object.html#equals-java.lang.Object-), [System.identityHashCode(java.lang.Object)](../../java/lang/System.html#identityHashCode-java.lang.Object-)
* #### equals
public boolean equals([Object](../../java/lang/Object.html "class in java.lang") obj)
Tests for equality between the specified object and this object. Two CodeSource objects are considered equal if their locations are of identical value and if their signer certificate chains are of identical value. It is not required that the certificate chains be in the same order.
Overrides:
`[equals](../../java/lang/Object.html#equals-java.lang.Object-)` in class `[Object](../../java/lang/Object.html "class in java.lang")`
Parameters:
`obj` \- the object to test for equality with this object.
Returns:
true if the objects are considered equal, false otherwise.
See Also:
[Object.hashCode()](../../java/lang/Object.html#hashCode--), [HashMap](../../java/util/HashMap.html "class in java.util")
* #### getLocation
public final [URL](../../java/net/URL.html "class in java.net") getLocation()
Returns the location associated with this CodeSource.
Returns:
the location (URL), or `null` if no URL was supplied during construction.
* #### getCertificates
public final [Certificate](../../java/security/cert/Certificate.html "class in java.security.cert")[] getCertificates()
Returns the certificates associated with this CodeSource.
If this CodeSource object was created using the[CodeSource(URL url, CodeSigner\[\] signers)](../../java/security/CodeSource.html#CodeSource-java.net.URL-java.security.CodeSigner:A-) constructor then its certificate chains are extracted and used to create an array of Certificate objects. Each signer certificate is followed by its supporting certificate chain (which may be empty). Each signer certificate and its supporting certificate chain is ordered bottom-to-top (i.e., with the signer certificate first and the (root) certificate authority last).
Returns:
a copy of the certificate array, or `null` if there is none.
* #### getCodeSigners
public final [CodeSigner](../../java/security/CodeSigner.html "class in java.security")[] getCodeSigners()
Returns the code signers associated with this CodeSource.
If this CodeSource object was created using the[CodeSource(URL url, java.security.cert.Certificate\[\] certs)](../../java/security/CodeSource.html#CodeSource-java.net.URL-java.security.cert.Certificate:A-) constructor then its certificate chains are extracted and used to create an array of CodeSigner objects. Note that only X.509 certificates are examined - all other certificate types are ignored.
Returns:
a copy of the code signer array, or `null` if there is none.
Since:
1.5
* #### implies
public boolean implies([CodeSource](../../java/security/CodeSource.html "class in java.security") codesource)
Returns true if this CodeSource object "implies" the specified CodeSource.
More specifically, this method makes the following checks. If any fail, it returns false. If they all succeed, it returns true.
* _codesource_ must not be null.
* If this object's certificates are not null, then all of this object's certificates must be present in _codesource_'s certificates.
* If this object's location (getLocation()) is not null, then the following checks are made against this object's location and_codesource_'s:
* _codesource_'s location must not be null.
* If this object's location equals _codesource_'s location, then return true.
* This object's protocol (getLocation().getProtocol()) must be equal to _codesource_'s protocol, ignoring case.
* If this object's host (getLocation().getHost()) is not null, then the SocketPermission constructed with this object's host must imply the SocketPermission constructed with _codesource_'s host.
* If this object's port (getLocation().getPort()) is not equal to -1 (that is, if a port is specified), it must equal_codesource_'s port or default port (codesource.getLocation().getDefaultPort()).
* If this object's file (getLocation().getFile()) doesn't equal_codesource_'s file, then the following checks are made: If this object's file ends with "/-", then _codesource_'s file must start with this object's file (exclusive the trailing "-"). If this object's file ends with a "/\*", then _codesource_'s file must start with this object's file and must not have any further "/" separators. If this object's file doesn't end with a "/", then _codesource_'s file must match this object's file with a '/' appended.
* If this object's reference (getLocation().getRef()) is not null, it must equal _codesource_'s reference.
For example, the codesource objects with the following locations and null certificates all imply the codesource with the location "http://java.sun.com/classes/foo.jar" and null certificates:
http:
http://*.sun.com/classes/*
http://java.sun.com/classes/-
http://java.sun.com/classes/foo.jar
Note that if this CodeSource has a null location and a null certificate chain, then it implies every other CodeSource.
Parameters:
`codesource` \- CodeSource to compare against.
Returns:
true if the specified codesource is implied by this codesource, false if not.
* #### toString
public [String](../../java/lang/String.html "class in java.lang") toString()
Returns a string describing this CodeSource, telling its URL and certificates.
Overrides:
`[toString](../../java/lang/Object.html#toString--)` in class `[Object](../../java/lang/Object.html "class in java.lang")`
Returns:
information about this CodeSource.