public StringList read() throws IOException { String line = lineStream.read(); StringList name = null; if ((line != null) && (!StringUtil.isEmpty(line))) { String name2; // find the location of the name separator in the line of data. int pos = line.indexOf(' '); if ((pos != -1)) { String parsed = line.substring(0, pos); // the data is in ALL CAPS ... so the easiest way is to convert // back to standard mixed case. if ((parsed.length() > 2) && (parsed.startsWith("MC"))) { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1,2).toLowerCase(locale) + parsed.substring(2,3).toUpperCase(locale) + parsed.substring(3).toLowerCase(locale); } else { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1).toLowerCase(locale); } name = new StringList(new String[]{name2}); } } return name; }
public static File getOpennlpDataDir() throws FileNotFoundException { final String dataDirectory = System.getProperty("OPENNLP_DATA_DIR"); if (StringUtil.isEmpty(dataDirectory)) { throw new IllegalArgumentException("The OPENNLP_DATA_DIR is not set."); } final File file = new File(System.getProperty("OPENNLP_DATA_DIR")); if (!file.exists()) { throw new FileNotFoundException("The OPENNLP_DATA_DIR path of " + dataDirectory + " was not found."); } return file; }
@Test(expected = NullPointerException.class) public void testIsEmptyWithNullString() { // should raise a NPE StringUtil.isEmpty(null); }
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line.trim())) {
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line)) {
public StringList read() throws IOException { String line = lineStream.read(); StringList name = null; if ((line != null) && (!StringUtil.isEmpty(line))) { String name2; // find the location of the name separator in the line of data. int pos = line.indexOf(' '); if ((pos != -1)) { String parsed = line.substring(0, pos); // the data is in ALL CAPS ... so the easiest way is to convert // back to standard mixed case. if ((parsed.length() > 2) && (parsed.startsWith("MC"))) { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1,2).toLowerCase(locale) + parsed.substring(2,3).toUpperCase(locale) + parsed.substring(3).toLowerCase(locale); } else { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1).toLowerCase(locale); } name = new StringList(new String[]{name2}); } } return name; }
public StringList read() throws IOException { String line = lineStream.read(); StringList name = null; if ((line != null) && (!StringUtil.isEmpty(line))) { String name2; // find the location of the name separator in the line of data. int pos = line.indexOf(' '); if ((pos != -1)) { String parsed = line.substring(0, pos); // the data is in ALL CAPS ... so the easiest way is to convert // back to standard mixed case. if ((parsed.length() > 2) && (parsed.startsWith("MC"))) { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1,2).toLowerCase(locale) + parsed.substring(2,3).toUpperCase(locale) + parsed.substring(3).toLowerCase(locale); } else { name2 = parsed.substring(0,1).toUpperCase(locale) + parsed.substring(1).toLowerCase(locale); } name = new StringList(new String[]{name2}); } } return name; }
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line.trim())) {
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line.trim())) {
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line)) {
while ((line = lineStream.read()) != null && !StringUtil.isEmpty(line)) {