use of android.support.v4.util.ArrayMap in project AntennaPod by AntennaPod.
the class FeedDiscoverer method findLinks.
private Map<String, String> findLinks(Document document, String baseUrl) {
Map<String, String> res = new ArrayMap<>();
Elements links = document.head().getElementsByTag("link");
for (Element link : links) {
String rel = link.attr("rel");
String href = link.attr("href");
if (!TextUtils.isEmpty(href) && (rel.equals("alternate") || rel.equals("feed"))) {
String type = link.attr("type");
if (type.equals(MIME_RSS) || type.equals(MIME_ATOM)) {
String title = link.attr("title");
String processedUrl = processURL(baseUrl, href);
if (processedUrl != null) {
res.put(processedUrl, (TextUtils.isEmpty(title)) ? href : title);
}
}
}
}
return res;
}
use of android.support.v4.util.ArrayMap in project AntennaPod by AntennaPod.
the class NanoHTTPD method decodeParameters.
/**
* Decode parameters from a URL, handing the case where a single parameter name might have been
* supplied several times, by return lists of values. In general these lists will contain a single
* element.
*
* @param queryString a query string pulled from the URL.
* @return a map of <code>String</code> (parameter name) to <code>List<String></code> (a list of the values supplied).
*/
protected Map<String, List<String>> decodeParameters(String queryString) {
Map<String, List<String>> parms = new ArrayMap<String, List<String>>();
if (queryString != null) {
StringTokenizer st = new StringTokenizer(queryString, "&");
while (st.hasMoreTokens()) {
String e = st.nextToken();
int sep = e.indexOf('=');
String propertyName = (sep >= 0) ? decodePercent(e.substring(0, sep)).trim() : decodePercent(e).trim();
if (!parms.containsKey(propertyName)) {
parms.put(propertyName, new ArrayList<String>());
}
String propertyValue = (sep >= 0) ? decodePercent(e.substring(sep + 1)) : null;
if (propertyValue != null) {
parms.get(propertyName).add(propertyValue);
}
}
}
return parms;
}
Aggregations