@Test public void testReadNexradTable() throws IOException { List<TableParser.Record> recs = TableParser.readTable(fromFile, "41,112,124i,136i,148i,160", 50000); TableParser.Record rec = recs.get(0); assertThat(rec.get(0).toString().trim()).isEqualTo("U_COMPNT_OF_WIND_AFTER_TIMESTEP"); assertThat(rec.get(2)).isEqualTo(0); assertThat(rec.get(3)).isEqualTo(2); assertThat(rec.get(4)).isEqualTo(2); assertThat(rec.get(5).toString().trim()).isEqualTo("m/s"); }
public static List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException { InputStream ios; if (urlString.startsWith("http:")) { URL url = new URL(urlString); ios = url.openStream(); } else { ios = new FileInputStream(urlString); } return readTable(ios, format, maxLines); }
TableParser { public static List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException { InputStream ios; if (urlString.startsWith("http:")) { URL url = new URL(urlString); ios = url.openStream(); } else { ios = new FileInputStream(urlString); } return readTable(ios, format, maxLines); } }
TableParser { public static List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException { InputStream ios; if (urlString.startsWith("http:")) { URL url = new URL(urlString); ios = url.openStream(); } else { ios = new FileInputStream(urlString); } return readTable(ios, format, maxLines); } TableParser(String format); }
TableParser { public static List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException { InputStream ios; if (urlString.startsWith("http:")) { URL url = new URL(urlString); ios = url.openStream(); } else { ios = new FileInputStream(urlString); } return readTable(ios, format, maxLines); } TableParser(String format); static List<Record> readTable(String urlString, String format, int maxLines); static List<Record> readTable(InputStream ios, String format, int maxLines); void setComment(String comment); List<Record> readAllRecords(InputStream ios, int maxLines); Field getField(int fldno); int getNumberOfFields(); DerivedField addDerivedField(Field from, Transform transform, Class type); }
TableParser { public static List<Record> readTable(String urlString, String format, int maxLines) throws IOException, NumberFormatException { InputStream ios; if (urlString.startsWith("http:")) { URL url = new URL(urlString); ios = url.openStream(); } else { ios = new FileInputStream(urlString); } return readTable(ios, format, maxLines); } TableParser(String format); static List<Record> readTable(String urlString, String format, int maxLines); static List<Record> readTable(InputStream ios, String format, int maxLines); void setComment(String comment); List<Record> readAllRecords(InputStream ios, int maxLines); Field getField(int fldno); int getNumberOfFields(); DerivedField addDerivedField(Field from, Transform transform, Class type);  }