public class HttpmdUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
computeDigest(URL url,
String algorithm)
Computes the message digest of data specified by a URL.
|
static String |
computeDigestCodebase(String sourceDirectory,
String codebase)
Computes the message digests for a codebase with HTTPMD URLs.
|
public static String computeDigest(URL url, String algorithm) throws IOException, NoSuchAlgorithmException
url
- the URL of the dataalgorithm
- the message digest algorithm to useString
in hexadecimal
formatIOException
- if an I/O exception occurs while reading data from
the URLNoSuchAlgorithmException
- if no provider is found for the message
digest algorithmNullPointerException
- if either argument is null
public static String computeDigestCodebase(String sourceDirectory, String codebase) throws IOException, MalformedURLException, NullPointerException
Do not use a directory on a remote filesystem, or a directory URL, if the underlying network access protocol does not provide adequate data integrity or authentication of the remote host.
sourceDirectory
- the filename or URL of the directory containing
the source files corresponding to the URLs in
codebase
codebase
- a space-separated list of HTTPMD URLs. The digest
values specified in the URLs will be ignored. The path portion of
the URLs, without the message digest parameters, will be used to
specify the source files, relative to
sourceDirectory
, to use for computing message
digests.IllegalArgumentException
- if any of the URLs in
codebase
fail to specify the HTTPMD protocolIOException
- if an I/O exception occurs while reading data from
the source filesMalformedURLException
- if any of the URLs in
codebase
have incorrect syntaxNullPointerException
- if either argument is null