List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:com.assemblade.opendj.acis.CompositeSubject.java
public static Subject parse(Subject left, String text) { Matcher compositeMatcher = compositePattern.matcher(text); if (compositeMatcher.find()) { String operand = compositeMatcher.group(1).trim(); String right = compositeMatcher.group(2); if (StringUtils.isNotEmpty(operand) && (operand.equalsIgnoreCase("AND") || operand.equalsIgnoreCase("OR"))) { return new CompositeSubject(left, Subject.parse(right), operand); }/*from ww w . ja va2s. co m*/ } return null; }
From source file:com.strategicgains.docussandra.ParseUtils.java
/** * Converts a string to a boolean./*from ww w . j a v a2s . c om*/ * * @param in String to convert to a boolean. * @return a boolean representation of the string. * @throws IndexParseFieldException if there is no way to determine if the * String should be interpreted as true or false. */ public static boolean parseStringAsBoolean(String in) throws IndexParseFieldException { in = in.trim(); if (in.equalsIgnoreCase("T"))//we could put this whole method in one or so line, but it is more readable this way { return true; } else if (in.equalsIgnoreCase("TRUE")) { return true; } else if (in.equalsIgnoreCase("1"))//byte level? { return true; } else if (in.equalsIgnoreCase("F")) { return false; } else if (in.equalsIgnoreCase("FALSE")) { return false; } else if (in.equalsIgnoreCase("0"))//byte level? { return false; } throw new IndexParseFieldException(in); }
From source file:Main.java
public static List<String> getSubtitlePath(String videoPath) { List<String> sbPathList = new ArrayList<String>(); if (TextUtils.isEmpty(videoPath)) return sbPathList; if (videoPath.contains("file")) { videoPath = videoPath.substring(7); }//from w w w. j a va 2s .com int end = videoPath.lastIndexOf("/", videoPath.length()); String path = videoPath.substring(0, end + 1); end = videoPath.lastIndexOf(".", videoPath.length()); if (-1 == end || null == path) return sbPathList; String subffix = videoPath.substring(0, end); File files = new File(path); if ((files != null) && (files.exists()) && (files.isDirectory())) { File[] filesInDir = files.listFiles(); long count = filesInDir.length; for (int num = 0; num < count; num++) { String filePath = filesInDir[num].getPath(); File subTitleFile = new File(filePath); if ((subTitleFile != null) && (subTitleFile.isFile()) && (subTitleFile.canRead())) { int pos = filePath.lastIndexOf(".", filePath.length()); String sub = filePath.substring(pos + 1, filePath.length()); if ((filePath.startsWith(subffix)) && (sub != null) && ((sub.equalsIgnoreCase("srt")) || (sub.equalsIgnoreCase("ass")) || (sub.equalsIgnoreCase("smi")) || (sub.equalsIgnoreCase("ssa")))) { sbPathList.add(filePath); } } } if (sbPathList.size() != 0) { return sbPathList; } } return sbPathList; }
From source file:com.pinterest.terrapin.tools.HFileGenerator.java
private static PartitionerType getPartitionerType(CommandLine cmd) { PartitionerType partitionerType = DEFAULT_PARTITIONER_TYPE; if (cmd.hasOption(PARTITIONER_TYPE_OPTION)) { String partitionerTypeStr = cmd.getOptionValue(PARTITIONER_TYPE_OPTION); if (partitionerTypeStr.equalsIgnoreCase(PartitionerType.MODULUS.name())) { partitionerType = PartitionerType.MODULUS; } else if (partitionerTypeStr.equalsIgnoreCase(PartitionerType.CASCADING.name())) { partitionerType = PartitionerType.CASCADING; } else {/*w w w . ja va 2s . c o m*/ throw new IllegalArgumentException("wrong partitioner type"); } } return partitionerType; }
From source file:gobblin.security.ssl.SSLContextFactory.java
/** * Create a {@link SSLContext} instance// www . java2 s.c o m * * @param keyStoreFile a p12 or jks file depending on key store type * @param keyStorePassword password to access the key store * @param keyStoreType type of key store * @param trustStoreFile a jks file * @param trustStorePassword password to access the trust store */ public static SSLContext createInstance(File keyStoreFile, String keyStorePassword, String keyStoreType, File trustStoreFile, String trustStorePassword) { if (!keyStoreType.equalsIgnoreCase(P12_STORE_TYPE_NAME) && !keyStoreType.equalsIgnoreCase(JKS_STORE_TYPE_NAME)) { throw new IllegalArgumentException("Unsupported keyStoreType: " + keyStoreType); } try { // Load KeyStore KeyStore keyStore = KeyStore.getInstance(keyStoreType); keyStore.load(toInputStream(keyStoreFile), keyStorePassword.toCharArray()); // Load TrustStore KeyStore trustStore = KeyStore.getInstance(JKS_STORE_TYPE_NAME); trustStore.load(toInputStream(trustStoreFile), trustStorePassword.toCharArray()); // Set KeyManger from keyStore KeyManagerFactory kmf = KeyManagerFactory.getInstance(DEFAULT_ALGORITHM); kmf.init(keyStore, keyStorePassword.toCharArray()); // Set TrustManager from trustStore TrustManagerFactory trustFact = TrustManagerFactory.getInstance(DEFAULT_ALGORITHM); trustFact.init(trustStore); // Set Context to TLS and initialize it SSLContext sslContext = SSLContext.getInstance(DEFAULT_PROTOCOL); sslContext.init(kmf.getKeyManagers(), trustFact.getTrustManagers(), null); return sslContext; } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.aliyun.openservices.odps.console.commands.logview.HelpAction.java
public static void printHelpInfo(PrintStream stream) { // Overall help message stream.println("Usage: log <subcommand> [options] [args]"); StringBuilder sb = new StringBuilder(); boolean first = true; for (String key : ActionRegistry.getActionNames()) { // Hide status action temporarily if (key.equalsIgnoreCase(GetStatusAction.ACTION_NAME)) { continue; }/*from w w w.ja v a 2 s . c om*/ if (first) { first = false; } else { sb.append(", "); } sb.append(key); } stream.println("Available subcommands are: " + sb.toString()); stream.println("Use 'log help <subcommand>' to get more info"); }
From source file:com.dfki.av.sudplan.Configuration.java
/** * Returns whether the configuration file {@code file} is supported by the * current implementation./*from w w w . j a v a 2s . c o m*/ * * @param file the configuration {@link File} to check * @return {@code true} if a {@code version} tag exists and its value is * equal to {@link #VERSION}. Otherwise {@code false}. */ private static boolean isConfigFileSupported(File file) { try { XMLConfiguration xmlConfig = new XMLConfiguration(file); if (!xmlConfig.containsKey("version")) { log.debug("No version tag."); return false; } String version = xmlConfig.getString("version"); if (version.equalsIgnoreCase(VERSION)) { return true; } else { log.debug("Version {} not supported.", version); return false; } } catch (ConfigurationException ex) { log.error(ex.toString()); } return false; }
From source file:Main.java
public static List<String> getSubtitlePath(String videoPath) { List<String> sbPathList = new ArrayList<String>(); if (TextUtils.isEmpty(videoPath)) return sbPathList; if (videoPath.contains("file")) { videoPath = videoPath.substring(7); }//from ww w.j a v a 2s.c o m int end = videoPath.lastIndexOf("/", videoPath.length()); String path = videoPath.substring(0, end + 1); end = videoPath.lastIndexOf(".", videoPath.length()); if (-1 == end || null == path) return sbPathList; String subffix = videoPath.substring(0, end); File files = new File(path); if ((files != null) && (files.exists()) && (files.isDirectory())) { File[] filesInDir = files.listFiles(); long count = filesInDir.length; for (int num = 0; num < count; num++) { String filePath = filesInDir[num].getPath(); File subTitleFile = new File(filePath); if ((subTitleFile != null) && (subTitleFile.isFile()) && (subTitleFile.canRead())) { int pos = filePath.lastIndexOf(".", filePath.length()); String sub = filePath.substring(pos + 1, filePath.length()); if ((filePath.startsWith(subffix)) && (sub != null) && ((sub.equalsIgnoreCase("srt")) || (sub.equalsIgnoreCase("ass")) || (sub.equalsIgnoreCase("smi")) || (sub.equalsIgnoreCase("ssa")) || (sub.equalsIgnoreCase("sub")))) { sbPathList.add(filePath); } } } if (sbPathList.size() != 0) { return sbPathList; } } return sbPathList; }
From source file:org.eclipse.lyo.rio.trs.tests.ChangeLogUpdationTest.java
private static String formatUpdateContent(String updateContent, String contentType) { if (contentType.equalsIgnoreCase(HttpConstants.CT_APPLICATION_RDF_XML)) { if (updateContent.contains("rdf:about=\"\"")) { String replacement = "rdf:about=\"" + createdResourceUrl + "\""; updateContent = updateContent.replace("rdf:about=\"\"", replacement); }//w ww . j a va 2 s . com } else if (contentType.equalsIgnoreCase(HttpConstants.CT_APPLICATION_JSON)) { if (updateContent.contains("\"rdf:about\":\"\"")) { String replacement = "\"rdf:about\":\"" + createdResourceUrl + "\""; updateContent = updateContent.replace("\"rdf:about\":\"\"", replacement); } } return updateContent; }
From source file:com.speed.ob.Obfuscator.java
private static Level parseLevel(String lvl) { if (lvl.equalsIgnoreCase("info")) { return Level.INFO; } else if (lvl.equalsIgnoreCase("warning")) { return Level.WARNING; } else if (lvl.equalsIgnoreCase("fine")) { return Level.FINE; } else if (lvl.equalsIgnoreCase("finer")) { return Level.FINER; } else if (lvl.equalsIgnoreCase("finest")) { return Level.FINEST; } else if (lvl.equalsIgnoreCase("all")) { return Level.ALL; } else if (lvl.equalsIgnoreCase("severe")) { return Level.SEVERE; } else if (lvl.equalsIgnoreCase("config")) { return Level.CONFIG; }//ww w . j a va 2 s .c om return Level.INFO; }