private void processLine(String[] titles, String[] values) throws FHIRException { count++; String src = loop; while (src.contains("[%")) { int i1 = src.indexOf("[%"); int i2 = src.indexOf("%]"); String s1 = src.substring(0, i1); String s2 = src.substring(i1 + 2, i2).trim(); String s3 = src.substring(i2+2); if ("count".equals(s2)) src = s1+Integer.toString(count)+s3; else { boolean b = false; for (String t : titles) { if (t.equals(s2)) { src = s1+getColumn(titles, values, s2)+s3; b = true; } } if (!b) throw new FHIRException("unknown column: '"+s2+"'"); } } dest.append(src); } }
public void process() throws IOException, FHIRException { buildTemplate(readSource()); dest = new StringBuilder(); dest.append(start); data.process(); dest.append(stop); out.write(dest.toString()); out.close(); }
private void processLine(String[] titles, String[] values) throws FHIRException { count++; String src = loop; while (src.contains("[%")) { int i1 = src.indexOf("[%"); int i2 = src.indexOf("%]"); String s1 = src.substring(0, i1); String s2 = src.substring(i1 + 2, i2).trim(); String s3 = src.substring(i2+2); if ("count".equals(s2)) src = s1+Integer.toString(count)+s3; else { boolean b = false; for (String t : titles) { if (t.equals(s2)) { src = s1+getColumn(titles, values, s2)+s3; b = true; } } if (!b) throw new FHIRException("unknown column: '"+s2+"'"); } } dest.append(src); } }
public void setData(InputStream data) { try { this.data = new DataReader(data); } catch (UnsupportedEncodingException e) { // DataReader is fixed to "UTF-8", so this exception cannot really occur } }
public void process() throws IOException, FHIRException { buildTemplate(readSource()); dest = new StringBuilder(); dest.append(start); data.process(); dest.append(stop); out.write(dest.toString()); out.close(); }
public void process() throws IOException, FHIRException { String[] titles = parseLine(); while (ready()) { String[] values = parseLine(); processLine(titles, values); } close(); }
public void setData(InputStream data) { try { this.data = new DataReader(data); } catch (UnsupportedEncodingException e) { // DataReader is fixed to "UTF-8", so this exception cannot really occur } }
public void process() throws IOException, FHIRException { String[] titles = parseLine(); while (ready()) { String[] values = parseLine(); processLine(titles, values); } close(); }