public class Urls
extends java.lang.Object
Constructor and Description |
---|
Urls() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
decode(java.lang.String text)
|
static java.lang.String |
encode(java.lang.String text)
encodes the string suitable for use in a URL, using default character set
(non-deprecated version of URLEncoder.encode)
|
static java.lang.String |
getBasename(java.lang.String url)
return the last segment of the given url before any '?', e.g.
|
static java.lang.String |
getProtocol(java.lang.String url)
returns the protocol (e.g.
|
static boolean |
isDirectory(java.lang.String fileUrl) |
static boolean |
isUrlWithProtocol(java.lang.String x)
returns true if the string begins with a non-empty string of letters followed by a colon,
i.e.
|
static java.lang.String |
mergePaths(java.lang.String... items)
returns the items with exactly one "/" between items (whether or not the individual items start or end with /),
except where character before the / is a : (url syntax) in which case it will permit multiple (will not remove any)
|
static com.google.common.base.Function<java.lang.String,java.net.URI> |
stringToUriFunction() |
static com.google.common.base.Function<java.lang.String,java.net.URL> |
stringToUrlFunction() |
static java.io.File |
toFile(java.lang.String fileUrl) |
static java.net.URI |
toUri(java.lang.String uri)
creates a URI, preserving null and propagating exceptions *unchecked*
|
static java.net.URI |
toUri(java.net.URL url)
creates a URI, preserving null and propagating exceptions *unchecked*
|
static java.net.URL |
toUrl(java.lang.String url)
creates a URL, preserving null and propagating exceptions *unchecked*
|
static java.net.URL |
toUrl(java.net.URI uri)
creates a URL, preserving null and propagating exceptions *unchecked*
|
public static com.google.common.base.Function<java.lang.String,java.net.URI> stringToUriFunction()
public static com.google.common.base.Function<java.lang.String,java.net.URL> stringToUrlFunction()
public static final java.net.URL toUrl(@Nullable java.lang.String url)
public static final java.net.URL toUrl(@Nullable java.net.URI uri)
public static final java.net.URI toUri(@Nullable java.lang.String uri)
public static final java.net.URI toUri(@Nullable java.net.URL url)
public static boolean isUrlWithProtocol(java.lang.String x)
public static java.lang.String mergePaths(java.lang.String... items)
public static java.lang.String encode(java.lang.String text)
public static java.lang.String decode(java.lang.String text)
public static java.lang.String getProtocol(java.lang.String url)
c:\xxx
being treated as a url)public static java.lang.String getBasename(java.lang.String url)
public static boolean isDirectory(java.lang.String fileUrl)
public static java.io.File toFile(java.lang.String fileUrl)