Back to project page spots.
The source code is released under:
MIT License
If you think the Android project spots listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dcc.matc89.spots.network; //from ww w. ja v a2s . c o m import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Utils { static String convertInputStreamToString(InputStream is) { java.util.Scanner s = new java.util.Scanner(is, "UTF-8").useDelimiter("\\A"); try{ return s.hasNext() ? s.next() : ""; } finally { s.close(); } } public static String getUrl(String url, String[] params) { if(params == null || params.length == 0) return url; StringBuilder builder = new StringBuilder(url).append('?'); for(int i = 0; i < params.length-1; i+=2){ if(i > 0) builder.append('&'); try { builder.append(URLEncoder.encode(params[i], "UTF-8")).append('=').append(URLEncoder.encode(params[i+1], "UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return builder.toString(); } }