Package net.fortuna.ical4j.util
Class Uris
java.lang.Object
net.fortuna.ical4j.util.Uris
$Id$
Created on 11/09/2005
Utility methods for working with URIs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringURI Scheme used when relaxed parsing is enabled and the given input stream lead to an invalid URI. -
Method Summary
Modifier and TypeMethodDescriptionstatic URIAttempts to create a URI instance and will optionally swallow any resulting URISyntaxException depending on configuredCompatibilityHints.static StringDecodes the specified URI string using the UTF-8 charset.static StringEncodes the specified URI string using the UTF-8 charset.
-
Field Details
-
INVALID_SCHEME
URI Scheme used when relaxed parsing is enabled and the given input stream lead to an invalid URI.- See Also:
-
-
Method Details
-
encode
Encodes the specified URI string using the UTF-8 charset. In the event that an exception is thrown, the specifed URI string is returned unmodified.- Parameters:
s- a URI string- Returns:
- an encoded URI string
-
decode
Decodes the specified URI string using the UTF-8 charset. In the event that an exception is thrown, the specifed URI string is returned unmodified.- Parameters:
s- a URI string- Returns:
- an encoded URI string
-
create
Attempts to create a URI instance and will optionally swallow any resulting URISyntaxException depending on configuredCompatibilityHints. Will also automatically attempt encoding of the string representation for greater compatibility.When relaxed parsing is enabled and if the string representation is not valid, a second URI creation attempt is made by extracting the scheme from the scheme specific part and URI encoding that later part. For example, "mailto: joe smith@example.com" becomes "mailto:joe%20smith@example.com".
If the second attempts also leads to a
URISyntaxException, an opaque URI is constructed with a scheme ofUris.INVALID_SCHEMEand a value corresponding to the initial representation.- Parameters:
s- a string representation of a URI.- Returns:
- a URI instance, which may not correspond to the URI string if a valid URI string is not specified and relaxed parsing is enabled.
- Throws:
URISyntaxException- if a valid URI string is not specified and relaxed parsing is disabled
-