public class HttpmdUtil extends Object
Modifier and Type | Field and Description |
---|---|
private static Handler |
handler
A URL handler to use for HTTPMD URLs so we don't require the protocol
handler to be installed.
|
Modifier | Constructor and Description |
---|---|
private |
HttpmdUtil()
Not instantiable.
|
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
commentChar(char c)
Returns true if the character is permitted in an HTTPMD comment.
|
private static String |
computeDigest(InputStream in,
String algorithm)
Computes the message digest for an input stream.
|
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.
|
(package private) static String |
digestString(byte[] digest)
Converts a message digest to a String in hexadecimal format.
|
(package private) static byte[] |
stringDigest(String s)
Converts a String in hexadecimal format to a message digest.
|
private static final Handler handler
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
private static String computeDigest(InputStream in, String algorithm) throws IOException, NoSuchAlgorithmException
IOException
NoSuchAlgorithmException
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
static String digestString(byte[] digest)
static byte[] stringDigest(String s) throws NumberFormatException
NumberFormatException
static boolean commentChar(char c)
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.