public class HtmlUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.util.logging.Logger |
loggerUrl
this logger is for opening connections to remote sites.
|
| Constructor and Description |
|---|
HtmlUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.net.URLConnection |
checkRedirect(java.net.URLConnection urlConnection)
Deprecated.
|
static void |
consumeStream(java.io.InputStream err)
Deprecated.
|
static java.net.URL[] |
getDirectoryListing(java.net.URL url)
Get the listing of the web directory, returning links that are "under" the given URL.
|
static java.net.URL[] |
getDirectoryListing(java.net.URL url,
java.io.InputStream urlStream)
Get the listing of the web directory, returning links that are "under" the given URL.
|
static java.net.URL[] |
getDirectoryListing(java.net.URL url,
java.io.InputStream urlStream,
boolean childCheck)
Get the listing of the web directory, returning links that are "under" the given URL.
|
static java.io.InputStream |
getInputStream(java.net.URL url)
get the inputStream, following redirects if a 301 or 302 is encountered.
|
static java.util.List<java.net.URL> |
getLinks(java.net.URL url,
java.lang.String content)
return the links found in the content, using url as the context.
|
static java.util.Map<java.lang.String,java.lang.String> |
getMetadata(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props)
Deprecated.
|
static boolean |
isDirectory(java.net.URL url) |
static java.lang.String |
readToString(java.net.URL url)
read the contents of the URL into a string, assuming UTF-8 encoding.
|
protected static final java.util.logging.Logger loggerUrl
public static boolean isDirectory(java.net.URL url)
@Deprecated
public static void consumeStream(java.io.InputStream err)
throws java.io.IOException
err - the input streamjava.io.IOExceptionHttpUtil.consumeStream(java.io.InputStream)public static java.net.URL[] getDirectoryListing(java.net.URL url,
java.io.InputStream urlStream)
throws java.io.IOException,
CancelledOperationException
url - the address.urlStream - stream containing the URL content, which must be UTF-8 (or US-ASCII)java.io.IOExceptionCancelledOperationExceptionpublic static java.net.URL[] getDirectoryListing(java.net.URL url,
java.io.InputStream urlStream,
boolean childCheck)
throws java.io.IOException,
CancelledOperationException
url - the address.urlStream - stream containing the URL content, which must be UTF-8 (or US-ASCII)childCheck - only return links to URLs "under" the url.java.io.IOExceptionCancelledOperationExceptionpublic static java.net.URL[] getDirectoryListing(java.net.URL url)
throws java.io.IOException,
CancelledOperationException
url - java.io.IOExceptionCancelledOperationExceptionpublic static java.io.InputStream getInputStream(java.net.URL url)
throws java.io.IOException,
CancelledOperationException
url - java.io.IOExceptionCancelledOperationExceptionDataSetURI.downloadResourceAsTempFile(java.net.URL, org.das2.util.monitor.ProgressMonitor)public static java.lang.String readToString(java.net.URL url)
throws java.io.IOException,
CancelledOperationException
url - java.io.IOExceptionCancelledOperationException@Deprecated
public static java.util.Map<java.lang.String,java.lang.String> getMetadata(java.net.URL url,
java.util.Map<java.lang.String,java.lang.String> props)
throws java.io.IOException
url - ftp,https, or http URLprops, - if non-null, may be a map containing cookie.java.io.IOException - when HEAD requests are made.HttpUtil.getMetadata(java.net.URL, java.util.Map)@Deprecated
public static java.net.URLConnection checkRedirect(java.net.URLConnection urlConnection)
throws java.io.IOException
urlConnection - if an HttpUrlConnection, check for 301 or 302; return connection otherwise.java.io.IOExceptionHttpUtil.checkRedirect(java.net.URLConnection)public static java.util.List<java.net.URL> getLinks(java.net.URL url,
java.lang.String content)
url - null or the url for the context.content - the html content.