Package au.com.bytecode.opencsv

Examples of au.com.bytecode.opencsv.CSVReader.readNext()


        CSVReader reader = new CSVReader(new StringReader((String) src));

        String[] nextLine;
        try {
            while ((nextLine = reader.readNext()) != null) {
                Map<String,String> product = new HashMap<String,String>();
                product.put("name",nextLine[0]);
                product.put("acv",nextLine[1]);
                product.put("cost",nextLine[2]);
                product.put("description",nextLine[3]);
View Full Code Here


        ArrayList<HistoricalPrice> result = new ArrayList<HistoricalPrice>();
        String[] nextLine;

        try {
            while ((nextLine = reader.readNext()) != null) {
                HistoricalPrice hp = new HistoricalPrice();
                hp.setTime(DateTime.parse(nextLine[0]));
                hp.setSpotPrice(Money.of(CurrencyUnit.USD, new BigDecimal(nextLine[1])));
                result.add(hp);
            }
View Full Code Here

       
        final ListOrderedMap<String, Integer> columns_xref = new ListOrderedMap<String, Integer>();
        CSVReader reader = new CSVReader(FileUtil.getReader(input));
        String row[] = null;
        boolean first = true;
        while ((row = reader.readNext()) != null) {
            if (first) {
                for (int i = 0; i < row.length; i++) {
                    columns_xref.put(row[i].toUpperCase(), i);
                } // FOR
                first = false;
View Full Code Here

    CSVReader csv = null;
    try {
      csv = newReader(new CharArrayReader(rowText.toString().toCharArray()), separatorChar,
              quoteChar, escapeChar);
      final String[] read = csv.readNext();

      for (int i = 0; i < numCols; i++) {
        if (read != null && i < read.length) {
          row.set(i, read[i]);
        } else {
View Full Code Here

    String[] header;
    String[] line;
    if (props.useHeader) {
      // read the header and then the first line
      header = reader.readNext();
      checkHeader(header);
      line = reader.readNext();
      Preconditions.checkNotNull(line, "No content to infer schema");

    } else {
View Full Code Here

    String[] line;
    if (props.useHeader) {
      // read the header and then the first line
      header = reader.readNext();
      checkHeader(header);
      line = reader.readNext();
      Preconditions.checkNotNull(line, "No content to infer schema");

    } else {
      // use the first line to create a header
      line = reader.readNext();
View Full Code Here

      line = reader.readNext();
      Preconditions.checkNotNull(line, "No content to infer schema");

    } else {
      // use the first line to create a header
      line = reader.readNext();
      Preconditions.checkNotNull(line, "No content to infer schema");
      header = new String[line.length];
      for (int i = 0; i < line.length; i += 1) {
        header[i] = "field_" + String.valueOf(i);
      }
View Full Code Here

          }
        } else if (line[i] == null || line[i].isEmpty()) {
          nullable[i] = true;
        }
      }
      line = reader.readNext();
      if (line == null) {
        break;
      }
    }
View Full Code Here

                    CSVParser.DEFAULT_QUOTE_CHARACTER,
                    CSVParser.DEFAULT_ESCAPE_CHARACTER);

            KAMStoreTables1_0 table;
            String[] data;
            while ((data = tabbedReader.readNext()) != null) {
                Matcher matcher = TABLE_HEADER_PATTERN.matcher(data[0]);
                if (data.length == 1 && matcher.matches()) {
                    table = KAMStoreTables1_0.getTableByName(matcher.group(1));

                    if (table == KAMStoreTables1_0.KAM_CATALOG_KAM) {
View Full Code Here

                Matcher matcher = TABLE_HEADER_PATTERN.matcher(data[0]);
                if (data.length == 1 && matcher.matches()) {
                    table = KAMStoreTables1_0.getTableByName(matcher.group(1));

                    if (table == KAMStoreTables1_0.KAM_CATALOG_KAM) {
                        String[] kcRowData = tabbedReader.readNext();

                        final String newKAMSchema = createKAMSchema(cfg,
                                kamName, kcRowData, filePath, noPreserve);

                        final DBConnection kcc =
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.