/** * Construct a CSV reader from a filename. Allows a delimiter character to be specified. * * @param filename The filename. * @param headers The headers. * @param format The format. */ public ReadCSV(final String filename, final boolean headers, final CSVFormat format) { try { this.reader = new BufferedReader(new FileReader(filename)); this.parseLine = new ParseCSVLine(format); begin(headers, format); } catch (final IOException e) { throw new EncogError(e); } }
/** * Construct a CSV reader from a filename. The format parameter specifies the separator character * to use, as well as the number format. * * @param filename The filename. * @param headers The headers. * @param delim The delimiter. */ public ReadCSV(final String filename, final boolean headers, final char delim) { try { final CSVFormat format = new CSVFormat(CSVFormat.getDecimalCharacter(), delim); this.parseLine = new ParseCSVLine(format); this.reader = new BufferedReader(new FileReader(filename)); begin(headers, format); } catch (final IOException e) { throw new EncogError(e); } }
/** * Construct a CSV reader from an input stream. Allows a delimiter character to be specified. * Numbers will be parsed using the current locale. * * @param is The InputStream to read from. * @param headers Are headers present? * @param delim What is the delimiter. */ public ReadCSV(final InputStream is, final boolean headers, final char delim) { final CSVFormat format = new CSVFormat(CSVFormat.getDecimalCharacter(), delim); this.parseLine = new ParseCSVLine(format); this.reader = new BufferedReader(new InputStreamReader(is)); begin(headers, format); }
/** * Construct a CSV reader from an input stream. The format parameter specifies the separator * character to use, as well as the number format. * * @param is The InputStream to read from. * @param headers Are headers present? * @param format What is the CSV format. */ public ReadCSV(final InputStream is, final boolean headers, final CSVFormat format) { this.reader = new BufferedReader(new InputStreamReader(is)); begin(headers, format); }