/** * Convert a String with the following format to List<String>: * string1:string2:string3:... * The List object contains elements: string1, string2, string3, ... * * @param listString - the String to convert * @param sep the separator character * @return List containing the elements in String */ // package-private, for testing static List<String> convertStringToList(String listString, char sep) { List<String> list = new java.util.ArrayList(); if (listString != null) { final ParamTokenizer ptoken = new ParamTokenizer(listString, sep); while (ptoken.hasMoreTokens()) { String token = ptoken.nextToken(); list.add(token); } } return list; }
ParamTokenizer stoken = new ParamTokenizer(unbracedString, sep); while (stoken.hasMoreTokens()) { String token = stoken.nextTokenKeepEscapes(); final ParamTokenizer nameTok = new ParamTokenizer(token, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (nameTok.hasMoreTokens() || name == null || value == null) throw new IllegalArgumentException("TODO : i18n : Invalid property syntax." + propsString);
/** * Return the next token from this tokenizer. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextToken() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(false); }
ParamTokenizer stoken = new ParamTokenizer(unbracedString, sep); while (stoken.hasMoreTokens()) { String token = stoken.nextTokenKeepEscapes(); final ParamTokenizer nameTok = new ParamTokenizer(token, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (nameTok.hasMoreTokens() || name == null || value == null) throw new IllegalArgumentException("TODO : i18n : Invalid property syntax." + propsString);
/** * Return the next token from this tokenizer. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextToken() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(false); }
/** * Convert a String with the following format to List<String>: * string1:string2:string3:... * The List object contains elements: string1, string2, string3, ... * * @param listString - the String to convert * @param sep the separator character * @return List containing the elements in String */ // package-private, for testing static List<String> convertStringToList(String listString, char sep) { List<String> list = new java.util.ArrayList(); if (listString != null) { final ParamTokenizer ptoken = new ParamTokenizer(listString, sep); while (ptoken.hasMoreTokens()) { String token = ptoken.nextToken(); list.add(token); } } return list; }
final Properties properties = new Properties(); if (propsString != null) { ParamTokenizer stoken = new ParamTokenizer(propsString, sep); while (stoken.hasMoreTokens()) { String token = stoken.nextTokenKeepEscapes(); final ParamTokenizer nameTok = new ParamTokenizer(token, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken().trim(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (name == null) // probably "::" throw new IllegalArgumentException( "Invalid property syntax, missing property value", token)); if (nameTok.hasMoreTokens()) throw new IllegalArgumentException( localStrings.getLocalString("PropertyExtraEquals",
/** * Return the next token from this tokenizer. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextToken() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(false); }
/** * convert a String with the following format to String Array: * string1,string2,string3,... * The String Array contains: string1, string2, string3, ... * * @param arrayString - the String to convert * @param sep the separator character * @return String[] containing the elements in String */ // package-private, for testing static String[] convertStringToStringArray(String arrayString, char sep) { final ParamTokenizer paramTok = new ParamTokenizer(arrayString, sep); List<String> strs = new ArrayList<String>(); while (paramTok.hasMoreTokens()) strs.add(paramTok.nextToken()); return strs.toArray(new String[strs.size()]); }
final Properties properties = new Properties(); if (propsString != null) { ParamTokenizer stoken = new ParamTokenizer(propsString, sep); while (stoken.hasMoreTokens()) { String token = stoken.nextTokenKeepEscapes(); final ParamTokenizer nameTok = new ParamTokenizer(token, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (name == null) // probably "::" throw new IllegalArgumentException( "Invalid property syntax, missing property value", token)); if (nameTok.hasMoreTokens()) throw new IllegalArgumentException( localStrings.getLocalString("PropertyExtraEquals",
/** * Return the next token from this tokenizer. * Keep escapes and quotes intact. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextTokenKeepEscapes() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(true); }
/** * Convert a String with the following format to List<String>: * string1:string2:string3:... * The List object contains elements: string1, string2, string3, ... * * @param listString - the String to convert * @param sep the separator character * @return List containing the elements in String */ // package-private, for testing static List<String> convertStringToList(String listString, char sep) { List<String> list = new java.util.ArrayList(); if (listString != null) { final ParamTokenizer ptoken = new ParamTokenizer(listString, sep); while (ptoken.hasMoreTokens()) { String token = ptoken.nextToken(); list.add(token); } } return list; }
final Properties properties = new Properties(); if (propsString != null) { ParamTokenizer stoken = new ParamTokenizer(propsString, sep); while (stoken.hasMoreTokens()) { String token = stoken.nextTokenKeepEscapes(); final ParamTokenizer nameTok = new ParamTokenizer(token, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken().trim(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (name == null) // probably "::" throw new IllegalArgumentException( "Invalid property syntax, missing property value", token)); if (nameTok.hasMoreTokens()) throw new IllegalArgumentException( localStrings.getLocalString("PropertyExtraEquals",
/** * Return the next token from this tokenizer. * Keep escapes and quotes intact. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextTokenKeepEscapes() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(true); }
/** * convert a String with the following format to String Array: * string1,string2,string3,... * The String Array contains: string1, string2, string3, ... * * @param arrayString - the String to convert * @param sep the separator character * @return String[] containing the elements in String */ // package-private, for testing static String[] convertStringToStringArray(String arrayString, char sep) { final ParamTokenizer paramTok = new ParamTokenizer(arrayString, sep); List<String> strs = new ArrayList<String>(); while (paramTok.hasMoreTokens()) strs.add(paramTok.nextToken()); return strs.toArray(new String[strs.size()]); }
/** * Return the next token from this tokenizer. * Keep escapes and quotes intact. * * @return the next token from this tokenizer. * @exception NoSuchElementException if there are no more tokens in this * tokenizer's string. */ public String nextTokenKeepEscapes() throws NoSuchElementException { if (currentPosition >= maxPosition) { throw new NoSuchElementException( localStrings.getLocalString("NoMoreTokens", "No more tokens")); } return scanToken(true); }
/** * convert a String with the following format to String Array: * string1,string2,string3,... * The String Array contains: string1, string2, string3, ... * * @param arrayString - the String to convert * @param sep the separator character * @return String[] containing the elements in String */ // package-private, for testing static String[] convertStringToStringArray(String arrayString, char sep) { final ParamTokenizer paramTok = new ParamTokenizer(arrayString, sep); List<String> strs = new ArrayList<String>(); while (paramTok.hasMoreTokens()) strs.add(paramTok.nextToken()); return strs.toArray(new String[strs.size()]); }
/** * Convert a List of Strings, each with the following format, to Properties: * name1=value1 * * @param propsList the List of Strings to convert * @return Properties containing the elements in the list */ private static Properties convertListToProperties(List<String> propsList) { final Properties properties = new Properties(); if (propsList != null) { for (String prop : propsList) { final ParamTokenizer nameTok = new ParamTokenizer(prop, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (nameTok.hasMoreTokens() || name == null || value == null) throw new IllegalArgumentException( localStrings.getLocalString("InvalidPropertySyntax", "Invalid property syntax.", prop)); properties.setProperty(name, value); } } return properties; }
/** * Convert a List of Strings, each with the following format, to Properties: * name1=value1 * * @param propsList the List of Strings to convert * @return Properties containing the elements in the list */ private static Properties convertListToProperties(List<String> propsList) { final Properties properties = new Properties(); if (propsList != null) { for (String prop : propsList) { final ParamTokenizer nameTok = new ParamTokenizer(prop, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (nameTok.hasMoreTokens() || name == null || value == null) throw new IllegalArgumentException( localStrings.getLocalString("InvalidPropertySyntax", "Invalid property syntax.", prop)); properties.setProperty(name, value); } } return properties; }
/** * Convert a List of Strings, each with the following format, to Properties: * name1=value1 * * @param propsList the List of Strings to convert * @return Properties containing the elements in the list */ private static Properties convertListToProperties(List<String> propsList) { final Properties properties = new Properties(); if (propsList != null) { for (String prop : propsList) { final ParamTokenizer nameTok = new ParamTokenizer(prop, '='); String name = null, value = null; if (nameTok.hasMoreTokens()) name = nameTok.nextToken(); if (nameTok.hasMoreTokens()) value = nameTok.nextToken(); if (nameTok.hasMoreTokens() || name == null || value == null) throw new IllegalArgumentException( localStrings.getLocalString("InvalidPropertySyntax", "Invalid property syntax.", prop)); properties.setProperty(name, value); } } return properties; }