public static Device parse(String src) throws ParseException { Device vo = null; if (src == null || src.isEmpty()) { throw new ParseException("unable to parse empty string", 0); } if (DEVICE_PATTERN.matcher(src).matches() == true) { vo = new Device(); String[] values = src.split("\\t"); vo.setAppkey(values[0].trim()); vo.setDevice(values[1].trim()); try { vo.setUsercount(Long.parseLong(values[2].trim())); vo.setSessioncount(Long.parseLong(values[3].trim())); } catch (NumberFormatException e) { throw new ParseException("invalid number value", 0); } } else { throw new ParseException("invalid pattern string", 0); } return vo; }