示例#1
0
  public void readLine() throws IOException {

    boolean addedQuote = false;

    line = new StringBuilder();

    String tmpline = "";

    String[] arrCSV = tmpline.split(CSVUtils.getSplitRegex(), -1);

    while (arrCSV.length < columnCount) {

      tmpline = bufferedReader.readLine();

      if (addedQuote) {
        line.setLength(line.length() - 1);
        addedQuote = false;
      }
      if (tmpline != null) {
        line.append(tmpline);
      }

      if (line.length() == 0) break;

      if ((tmpline != null && !tmpline.isEmpty()) && tmpline.charAt(tmpline.length() - 1) != '"') {
        line.append("\"");
        addedQuote = true;
      }

      arrCSV = line.toString().split(CSVUtils.getSplitRegex(), -1);
    }

    if (line.length() > 0 && bufferData) {
      buffer.add(getLine());
    }
  }
示例#2
0
 public String[] getLineAsArray() {
   return line.toString().split(CSVUtils.getSplitRegex(), -1);
 }