com.bumptech.glide.load.model
Class GlideUrl

java.lang.Object
  extended by com.bumptech.glide.load.model.GlideUrl

public class GlideUrl
extends Object

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, 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.


Constructor Summary
GlideUrl(String url)
           
GlideUrl(String url, Headers headers)
           
GlideUrl(URL url)
           
GlideUrl(URL url, Headers headers)
           
 
Method Summary
 boolean equals(Object o)
           
 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()
           
 String toString()
           
 String toStringUrl()
          Returns a properly escaped String url that can be used to make http/https requests.
 URL toURL()
          Returns a properly escaped URL that can be used to make http/https requests.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlideUrl

public GlideUrl(URL url)

GlideUrl

public GlideUrl(String url)

GlideUrl

public GlideUrl(URL url,
                Headers headers)

GlideUrl

public GlideUrl(String url,
                Headers headers)
Method Detail

toURL

public URL toURL()
          throws MalformedURLException
Returns a properly escaped URL that can be used to make http/https requests.

Throws:
MalformedURLException
See Also:
toStringUrl(), getCacheKey()

toStringUrl

public String toStringUrl()
Returns a properly escaped String url that can be used to make http/https requests.

See Also:
toURL(), getCacheKey()

getHeaders

public Map<String,String> getHeaders()
Returns a non-null Map containing headers.


getCacheKey

public String getCacheKey()
Returns an inexpensive to calculate 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.


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object