当前位置: 首页>>代码示例>>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;未经允许,请勿转载。