List of usage examples for android.net Uri isOpaque
public boolean isOpaque()
From source file:Main.java
private static Set<String> getQueryParameterNames(Uri uri) { if (uri.isOpaque()) { throw new UnsupportedOperationException("This isn't a hierarchical URI."); }/*from www . j a v a 2s .com*/ 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); names.add(Uri.decode(name)); // Move start to end of name. start = end + 1; } while (start < query.length()); return Collections.unmodifiableSet(names); }
From source file:Main.java
public static Set<String> getQueryParameterNames(Uri uri) { if (uri.isOpaque()) { throw new UnsupportedOperationException("This isn't a hierarchical URI."); }/* w w w .j a va2s . co m*/ 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); names.add(Uri.decode(name)); // Move start to end of name. start = end + 1; } while (start < query.length()); return Collections.unmodifiableSet(names); }
From source file:org.lol.reddit.common.General.java
public static Set<String> getUriQueryParameterNames(final Uri uri) { if (uri.isOpaque()) { throw new UnsupportedOperationException("This isn't a hierarchical URI."); }//from w ww. j av a 2 s. c o m final String query = uri.getEncodedQuery(); if (query == null) { return Collections.emptySet(); } final Set<String> names = new LinkedHashSet<String>(); int pos = 0; while (pos < query.length()) { int next = query.indexOf('&', pos); int end = (next == -1) ? query.length() : next; int separator = query.indexOf('=', pos); if (separator > end || separator == -1) { separator = end; } String name = query.substring(pos, separator); names.add(Uri.decode(name)); // Move start to end of name. pos = end + 1; } return Collections.unmodifiableSet(names); }