public class GlideUrl extends Object implements Key
Users wishing to replace the class for handling URLs must register a factory using GlideUrl.
To obtain a properly escaped URL, call toURL()
. To obtain a properly escaped string
URL, call toStringUrl()
. To obtain a less safe, but less expensive to calculate cache
key, call getCacheKey()
.
This class can also optionally wrap Headers
for
convenience.
CHARSET, STRING_CHARSET_NAME
Constructor and Description |
---|
GlideUrl(String url) |
GlideUrl(String url,
Headers headers) |
GlideUrl(URL url) |
GlideUrl(URL url,
Headers headers) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
For caching to work correctly, implementations must implement this method and
Key.hashCode() . |
String |
getCacheKey()
Returns an inexpensive to calculate
String suitable for use as a disk cache key. |
Map<String,String> |
getHeaders()
Returns a non-null
Map containing headers. |
int |
hashCode()
For caching to work correctly, implementations must implement this method and
Key.equals(Object) . |
String |
toString() |
String |
toStringUrl()
Returns a properly escaped
String url that can be used to make http/https requests. |
URL |
toURL() |
void |
updateDiskCacheKey(MessageDigest messageDigest)
Adds all uniquely identifying information to the given digest.
|
public URL toURL() throws MalformedURLException
MalformedURLException
public String toStringUrl()
String
url that can be used to make http/https requests.toURL()
,
getCacheKey()
public String getCacheKey()
String
suitable for use as a disk cache key.
This method does not include headers.
Unlike toStringUrl()
} and toURL()
, this method does not escape
input.
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest)
Key
Note - Using MessageDigest.reset()
inside of this method will result
in undefined behavior.
updateDiskCacheKey
in interface Key
public boolean equals(Object o)
Key
Key.hashCode()
.