List of usage examples for java.lang String contains
public boolean contains(CharSequence s)
From source file:Main.java
public static String parseValue(Map<String, List<String>> responseHeader, String parentKey, String valueKey) { List<String> contentTypes = responseHeader.get(parentKey); if (contentTypes != null && contentTypes.size() > 0) { String contentType = contentTypes.get(0); StringTokenizer stringTokenizer = new StringTokenizer(contentType, ";"); while (stringTokenizer.hasMoreTokens()) { String token = stringTokenizer.nextToken(); if (token.contains(valueKey)) { String[] values = token.split("="); if (values.length > 1) { return values[1]; }/* w w w .j av a2 s.com*/ } } } return null; }
From source file:Main.java
public static boolean isWindowsOS() { Properties prop = System.getProperties(); String os = prop.getProperty("os.name"); // log.info("platform is:"+os); if (os.contains("Windows")) { return true; }/* w w w .j a v a 2s. c om*/ return false; }
From source file:Main.java
public static String getHost(byte[] request) { String requestStr = new String(request); String cookies = ""; if (requestStr.contains("Host:")) { cookies = requestStr.substring(requestStr.indexOf("Host:")); cookies = cookies.substring(5, cookies.indexOf("\r\n")).trim(); }//from w w w. j a v a2 s.c o m return cookies; }
From source file:Main.java
public static String[] GetSupportedFileSystems() { try {// w ww . j a va 2s . c o m FileInputStream fProcFS = new FileInputStream(new File("/proc/filesystems")); ArrayList<String> filesystems = new ArrayList<String>(); byte[] data1 = new byte[1024]; int len = fProcFS.read(data1); fProcFS.close(); String fs = new String(data1, 0, len); if (fs.contains("rfs")) filesystems.add("rfs"); if (fs.contains("jfs")) filesystems.add("jfs"); if (fs.contains("ext2")) filesystems.add("ext2"); if (fs.contains("ext3")) filesystems.add("ext3"); if (fs.contains("ext4")) filesystems.add("ext4"); String[] List = (String[]) filesystems.toArray(new String[filesystems.size()]); return List; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:Main.java
public static boolean copyAssetFolder(AssetManager assetManager, String fromAssetPath, String toPath) { try {//from w ww . j av a2 s . c om String[] files = assetManager.list(fromAssetPath); new File(toPath).mkdirs(); boolean res = true; for (String file : files) if (file.contains(".")) res &= copyAsset(assetManager, fromAssetPath + "/" + file, toPath + "/" + file); else res &= copyAssetFolder(assetManager, fromAssetPath + "/" + file, toPath + "/" + file); return res; } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:Main.java
public static boolean isPhoneRooted() { // get from build info String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains("test-keys")) { return true; }//w w w . j av a 2 s .c o m boolean bool = false; String[] arrayOfString1 = { "/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/", "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/" }; for (String str : arrayOfString1) { File localFile = new File(str + "su"); if (localFile.exists()) { bool = true; break; } } return bool; }
From source file:org.cloudfoundry.identity.uaa.user.UaaAuthority.java
public static GrantedAuthority authority(String value) { return value.contains("uaa.admin") ? UAA_ADMIN : value.contains("uaa.admin") ? UAA_USER : new SimpleGrantedAuthority(value); }
From source file:desi.juan.internal.util.MethodGeneratorUtils.java
public static String uriToCammelCase(String uri) { uri = uri.replace("{", "/").replace("}", "/"); StringBuilder result = new StringBuilder(); for (String word : StringUtils.split(uri, "/")) { if (word.contains("_")) { word = CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, word); }//from w w w .ja va 2s. c om result.append(StringUtils.capitalize(word)); } return StringUtils.uncapitalize(result.toString()); }
From source file:com.hortonworks.minicluster.util.StringAssertUtils.java
/** * * @param value/*from ww w . java2 s. co m*/ */ public static void assertNotEmptyAndNoSpaces(String value) { Assert.hasText(value); if (value.contains(" ")) { throw new IllegalArgumentException("'value' must not contain spaces"); } }
From source file:Main.java
public static boolean isEmulator() { String product = Build.PRODUCT; return (product != null && (product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_"))); }