|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.uadetector.internal.util.UrlUtil
public final class UrlUtil
This class is intended to provide URL utility functions that encapsulate the checked exceptions like
MalformedURLException during the construction of an URL or the IOException while opening a stream to
an URL.
| Method Summary | |
|---|---|
static java.net.URL |
build(java.lang.String url)
Creates an URL instance from the given String representation. |
static java.io.InputStream |
open(java.net.URL url)
Tries to open an InputStream to the given URL. |
static java.lang.String |
read(java.net.URL url,
java.nio.charset.Charset charset)
Reads the content of the passed URL as string representation. |
static java.net.URL |
toUrl(java.io.File file)
Gets the URL to a given File. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.net.URL build(@Nonnull
java.lang.String url)
URL instance from the given String representation.MalformedURLException by an IllegalStateOfArgumentException.
url - String representation of an URL
URL instance
net.sf.qualitycheck.exception.IllegalNullArgumentException - if the given argument is null
net.sf.qualitycheck.exception.IllegalStateOfArgumentException - if the string representation of the given URL is invalid and a MalformedURLException occurs
public static java.io.InputStream open(@Nonnull
java.net.URL url)
InputStream to the given URL.
url - URL which should be opened
net.sf.qualitycheck.exception.IllegalNullArgumentException - if the given argument is null
CanNotOpenStreamException - if no stream to the given URL can be established
public static java.lang.String read(@Nonnull
java.net.URL url,
@Nonnull
java.nio.charset.Charset charset)
throws java.io.IOException
URL as string representation.
url - URL to UAS datacharset - the character set in which the data should be read
String
net.sf.qualitycheck.exception.IllegalNullArgumentException - if any of the given arguments is null
CanNotOpenStreamException - if no stream to the given URL can be established
java.io.IOException - if an I/O error occurs
public static java.net.URL toUrl(@Nonnull
java.io.File file)
File.
file - file to be converted to a URL
java.lang.IllegalStateException - if no URL can be resolved to the given file
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||