public class URLTools
extends java.lang.Object
implements javax.swing.event.HyperlinkListener
| Modifier and Type | Method and Description |
|---|---|
static boolean |
browse(java.net.URI uri)
Throws the given URI at the OS and returns the result.
|
static boolean |
browse(java.net.URL url)
Opens the default browser with the given URL (if supported)
|
static javax.swing.event.HyperlinkListener |
getHyperlinkListener() |
void |
hyperlinkUpdate(javax.swing.event.HyperlinkEvent he) |
static boolean |
openURL(java.net.URL url)
Tries to open the given _url trying various methods.
|
static java.lang.String |
readFromURL(java.lang.String url)
Opens a connection to a given url and returns the resource content as a string.
|
static java.lang.String |
readFromURL(java.lang.String url,
java.lang.String encoding) |
static java.util.Map |
splitQuery(java.net.URL url)
Parses and decodes the query-parameters from a given URL and returns them in a map
e.g.
|
public static javax.swing.event.HyperlinkListener getHyperlinkListener()
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent he)
hyperlinkUpdate in interface javax.swing.event.HyperlinkListenerpublic static boolean browse(java.net.URL url)
url - The URL to browse totrue if the passed URL could successfully be browsed topublic static boolean browse(java.net.URI uri)
public static boolean openURL(java.net.URL url)
public static java.util.Map splitQuery(java.net.URL url)
public static java.lang.String readFromURL(java.lang.String url)
throws java.net.MalformedURLException,
java.io.IOException
url - the url to read.encoding - the encoding to interpret the document't content as (default: "UTF-8")java.net.MalformedURLExceptionjava.io.IOExceptionpublic static java.lang.String readFromURL(java.lang.String url,
java.lang.String encoding)
throws java.net.MalformedURLException,
java.io.IOException
java.net.MalformedURLExceptionjava.io.IOExceptionCopyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.