Package com.bumptech.glide.load.model
Class GlideUrl
- java.lang.Object
-
- com.bumptech.glide.load.model.GlideUrl
-
- All Implemented Interfaces:
Key
public class GlideUrl extends java.lang.Object implements Key
A wrapper for strings representing http/https URLs responsible for ensuring URLs are properly escaped and avoiding unnecessary URL instantiations for loaders that require only string urls rather than URL objects.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, calltoStringUrl(). To obtain a less safe, but less expensive to calculate cache key, callgetCacheKey().This class can also optionally wrap
Headersfor convenience.
-
-
Field Summary
-
Fields inherited from interface com.bumptech.glide.load.Key
CHARSET, STRING_CHARSET_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)For caching to work correctly, implementations must implement this method andKey.hashCode().java.lang.StringgetCacheKey()Returns an inexpensive to calculateStringsuitable for use as a disk cache key.java.util.Map<java.lang.String,java.lang.String>getHeaders()Returns a non-nullMapcontaining headers.inthashCode()For caching to work correctly, implementations must implement this method andKey.equals(Object).java.lang.StringtoString()java.lang.StringtoStringUrl()Returns a properly escapedStringurl that can be used to make http/https requests.java.net.URLtoURL()voidupdateDiskCacheKey(java.security.MessageDigest messageDigest)Adds all uniquely identifying information to the given digest.
-
-
-
Method Detail
-
toURL
public java.net.URL toURL() throws java.net.MalformedURLException- Throws:
java.net.MalformedURLException
-
toStringUrl
public java.lang.String toStringUrl()
Returns a properly escapedStringurl that can be used to make http/https requests.- See Also:
toURL(),getCacheKey()
-
getHeaders
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Returns a non-nullMapcontaining headers.
-
getCacheKey
public java.lang.String getCacheKey()
Returns an inexpensive to calculateStringsuitable for use as a disk cache key.This method does not include headers.
Unlike
toStringUrl()} andtoURL(), this method does not escape input.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
updateDiskCacheKey
public void updateDiskCacheKey(@NonNull java.security.MessageDigest messageDigest)Description copied from interface:KeyAdds all uniquely identifying information to the given digest.Note - Using
MessageDigest.reset()inside of this method will result in undefined behavior.- Specified by:
updateDiskCacheKeyin interfaceKey
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:KeyFor caching to work correctly, implementations must implement this method andKey.hashCode().
-
hashCode
public int hashCode()
Description copied from interface:KeyFor caching to work correctly, implementations must implement this method andKey.equals(Object).
-
-