當前位置: 首頁>>代碼示例>>Java>>正文


Java Uri.getEncodedQuery方法代碼示例

本文整理匯總了Java中android.net.Uri.getEncodedQuery方法的典型用法代碼示例。如果您正苦於以下問題:Java Uri.getEncodedQuery方法的具體用法?Java Uri.getEncodedQuery怎麽用?Java Uri.getEncodedQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.getEncodedQuery方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: a

import android.net.Uri; //導入方法依賴的package包/類
public static MLinkResult a(Uri uri, Uri uri2) {
    if (uri2 == null) {
        return new MLinkResult();
    }
    String scheme = uri2.getScheme();
    String host = uri2.getHost();
    int port = uri2.getPort();
    String encodedPath = uri2.getEncodedPath();
    String encodedQuery = uri2.getEncodedQuery();
    String scheme2 = uri.getScheme();
    String host2 = uri.getHost();
    int port2 = uri.getPort();
    String encodedPath2 = uri.getEncodedPath();
    String encodedQuery2 = uri.getEncodedQuery();
    if (n.a(scheme, scheme2) && n.a(host, host2) && port == port2) {
        return a(encodedPath, encodedPath2, a(encodedQuery2, encodedQuery));
    }
    return new MLinkResult();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:20,代碼來源:d.java

示例2: encodedQueryParameters

import android.net.Uri; //導入方法依賴的package包/類
/**
 * Returns a map of the unique names of all query parameters. Iterating
 * over the set will return the names in order of their first occurrence.
 *
 * @param uri The URI to transform.
 * @return A map of decoded names.
 */
@NonNull
private static Map<String, String> encodedQueryParameters(@NonNull final Uri uri) {
    final HashMap<String, String> map = new HashMap<>();
    final String query = uri.getEncodedQuery();
    if (query != null) {

        String[] ands = query.split("&");
        for (String and : ands) {
            int splitIndex = and.indexOf("=");
            if (splitIndex != -1) {
                map.put(and.substring(0, splitIndex), and.substring(splitIndex + 1));
            } else {
                Log.w("ParametersParseError", "query: " + query);
            }
        }
    }
    return map;
}
 
開發者ID:drakeet,項目名稱:Floo,代碼行數:26,代碼來源:Floo.java

示例3: getQueryParameter

import android.net.Uri; //導入方法依賴的package包/類
/**
 * Return a map of argument->value from a query in a URI
 *
 * @param uri The URI
 */
private Map<String, String> getQueryParameter(Uri uri) {
    if (uri.isOpaque()) {
        return Collections.emptyMap();
    }

    String query = uri.getEncodedQuery();
    if (query == null) {
        return Collections.emptyMap();
    }

    Map<String, String> parameters = new LinkedHashMap<>();
    int start = 0;
    do {
        int next = query.indexOf('&', start);
        int end = (next == -1) ? query.length() : next;

        int separator = query.indexOf('=', start);
        if (separator > end || separator == -1) {
            separator = end;
        }

        String name = query.substring(start, separator);
        String value;
        if (separator < end)
            value = query.substring(separator + 1, end);
        else
            value = "";

        parameters.put(Uri.decode(name), Uri.decode(value));

        // Move start to end of name.
        start = end + 1;
    } while (start < query.length());

    return Collections.unmodifiableMap(parameters);
}
 
開發者ID:jpmeijers,項目名稱:ttnmapper_android_v2,代碼行數:42,代碼來源:LogInToTTN.java

示例4: getQueryParameterNames

import android.net.Uri; //導入方法依賴的package包/類
public static Set<String> getQueryParameterNames(Uri uri) {
    String query = uri.getEncodedQuery();
    if (query == null) {
        return Collections.emptySet();
    }

    Set<String> names = new LinkedHashSet<String>();
    int start = 0;
    do {
        int next = query.indexOf('&', start);
        int end = (next == -1) ? query.length() : next;

        int separator = query.indexOf('=', start);
        if (separator > end || separator == -1) {
            separator = end;
        }

        String name = query.substring(start, separator);
        try {
            names.add(URLDecoder.decode(name, "UTF-8"));
        } catch (Exception e) {
            e.printStackTrace();
        }

        start = end + 1;
    } while (start < query.length());

    return Collections.unmodifiableSet(names);
}
 
開發者ID:luojilab,項目名稱:DDComponentForAndroid,代碼行數:30,代碼來源:UriUtils.java

示例5: appendQuery

import android.net.Uri; //導入方法依賴的package包/類
private static Uri.Builder appendQuery(Uri.Builder builder, String query) {
    Uri current = builder.build();
    String oldQuery = current.getEncodedQuery();
    if (oldQuery != null && oldQuery.length() > 0) {
        query = oldQuery + "&" + query;
    }
    return builder.encodedQuery(query);
}
 
開發者ID:AltimitSystems,項目名稱:mv-android-client,代碼行數:9,代碼來源:WebPlayerActivity.java


注:本文中的android.net.Uri.getEncodedQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。