|
Multivalent API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectphelps.net.URIs
URI-related utility classes.
fix(String)
, canonicalize(URI)
toURL(URI)
, encode(String)
and decode(String)
without throwing Exception
Method Summary | |
---|---|
static java.net.URI |
canonicalize(java.net.URI uri)
Canonicalizes URI |
static java.lang.String |
decode(java.lang.String s)
Like URLDecoder but without the hassle. |
static java.lang.String |
encode(java.lang.String s)
Like URLEncoder but without the hassle. |
static java.lang.String |
fix(java.lang.String s)
Fixes up alleged URIs to be acceptable to the strict parsing of URI . |
static java.net.URL |
toURL(java.net.URI uri)
With toURL(URI) , safe interconversion between URI and URL, working around Java bugs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String encode(java.lang.String s)
URLEncoder
but without the hassle.
Java's URLEncode and URLDecode are too complicated. First, they are separate classes of one method each, whereas they should both be stuffed in java.net.URL or java.net.URI.
Second, starting in Java 1.4, you have to explicitly supply "UTF-8" in order to meet the W3C's recommendation, which is a hassle,
and you have to catch "UnsupportedEncodingException", which should never happen. Bah!
public static java.lang.String decode(java.lang.String s)
URLDecoder
but without the hassle.
public static java.lang.String fix(java.lang.String s)
URI
.
In practice browsers have to be robust against invalid URIs.
public static java.net.URI canonicalize(java.net.URI uri)
public static java.net.URL toURL(java.net.URI uri) throws java.net.MalformedURLException
toURL(URI)
, safe interconversion between URI and URL, working around Java bugs.
java.net.MalformedURLException
|
Multivalent API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |