@Override public Result<Record> fetchFromStringData(List<String[]> strings) { return fetchFromStringData(strings, true); }
@Override public Result<Record> fetchFromStringData(String[]... strings) { return fetchFromStringData(list(strings), true); }
@Override public Result<Record> fetchFromStringData(String[]... data) { return fetchFromStringData(list(data)); }
@Override public Result<Record> fetchFromTXT(String string, String nullLiteral) { return fetchFromStringData(Tools.parseTXT(string, nullLiteral)); }
@Override public Result<Record> fetchFromTXT(String string, String nullLiteral) { return fetchFromStringData(Utils.parseTXT(string, nullLiteral)); }
@Override public Result<Record> fetchFromHTML(String string) { return fetchFromStringData(Tools.parseHTML(string)); }
@Override public Result<Record> fetchFromCSV(String string, boolean header, char delimiter) { CSVReader reader = new CSVReader(new StringReader(string), delimiter); List<String[]> list = null; try { list = reader.readAll(); } catch (IOException e) { throw new DataAccessException("Could not read the CSV string", e); } finally { try { reader.close(); } catch (IOException ignore) {} } return fetchFromStringData(list, header); }
@Override public Result<Record> fetchFromCSV(String string, char delimiter) { CSVReader reader = new CSVReader(new StringReader(string), delimiter); List<String[]> data = null; try { data = reader.readAll(); } catch (IOException e) { throw new DataAccessException("Could not read the CSV string", e); } finally { try { reader.close(); } catch (IOException ignore) {} } return fetchFromStringData(data); }
@Override public Result<Record> fetchFromJSON(String string) { List<String[]> data = new LinkedList<String[]>(); JSONReader reader = null; try { reader = new JSONReader(new StringReader(string)); List<String[]> records = reader.readAll(); String[] fields = reader.getFields(); data.add(fields); data.addAll(records); } catch (IOException e) { throw new DataAccessException("Could not read the JSON string", e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException ignore) {} } return fetchFromStringData(data); }
@Override public Result<Record> fetchFromJSON(String string) { List<String[]> list = new LinkedList<String[]>(); JSONReader reader = null; try { reader = new JSONReader(new StringReader(string)); List<String[]> records = reader.readAll(); String[] fields = reader.getFields(); list.add(fields); list.addAll(records); } catch (IOException e) { throw new DataAccessException("Could not read the JSON string", e); } finally { try { if (reader != null) { reader.close(); } } catch (IOException ignore) {} } return fetchFromStringData(list); }