package com.alibaba.alibclinkpartner.smartlink.util; import android.util.Log; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Map; import java.util.regex.Pattern; public class g { /* renamed from: a reason: collision with root package name */ private static final String f16876a = "g"; public static String a(Map<String, String> map) { if (map == null || map.isEmpty()) { return ""; } StringBuffer stringBuffer = new StringBuffer(); for (String str : map.keySet()) { String str2 = map.get(str); if (str2 != null) { try { str2 = URLEncoder.encode(str2, "utf-8"); } catch (UnsupportedEncodingException e14) { Log.e(f16876a, e14.toString()); } } str = URLEncoder.encode(str, "utf-8"); if (str2 != null) { stringBuffer.append("&"); stringBuffer.append(str); stringBuffer.append("="); stringBuffer.append(str2); } } return stringBuffer.toString().substring(1); } public static boolean a(String str) { int length; if (!(str == null || (length = str.length()) == 0)) { for (int i10 = 0; i10 < length; i10++) { if (!Character.isWhitespace(str.charAt(i10))) { return false; } } } return true; } public static boolean b(String str) { if (a(str)) { return false; } return Pattern.compile("[0-9]*").matcher(str).matches(); } public static boolean c(String str) { if (a(str)) { return false; } return Pattern.compile("^(http://|https://)?((?:[A-Za-z0-9]+-[A-Za-z0-9]+|[A-Za-z0-9]+)\\.)+([A-Za-z]+)[/\\?\\:]?.*$").matcher(str).matches(); } public static String d(String str) { try { return URLEncoder.encode(str, "UTF-8"); } catch (Exception e14) { e14.printStackTrace(); return ""; } } }