Examples of tokenizeLine()


Examples of com.cloudera.cdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

  private List<String> split(String line, char separator, boolean isQuoted) throws IOException {
    Record record = new Record();
    CSVTokenizer tokenizer;
    if (isQuoted) {
      tokenizer = new QuotedCSVTokenizer(separator, false, new ArrayList(), '"');
      tokenizer.tokenizeLine(line, new BufferedReader(new StringReader("")), record);     
    } else {
      tokenizer = new SimpleCSVTokenizer(separator, false, new ArrayList());
      tokenizer.tokenizeLine(line, null, record);
    }
    List results = new ArrayList();
View Full Code Here

Examples of com.cloudera.cdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

    if (isQuoted) {
      tokenizer = new QuotedCSVTokenizer(separator, false, new ArrayList(), '"');
      tokenizer.tokenizeLine(line, new BufferedReader(new StringReader("")), record);     
    } else {
      tokenizer = new SimpleCSVTokenizer(separator, false, new ArrayList());
      tokenizer.tokenizeLine(line, null, record);
    }
    List results = new ArrayList();
    for (int i = 0; i < record.getFields().asMap().size(); i++) {
      assertEquals(1, record.get("column" + i).size());
      results.add(record.getFirstValue("column" + i));
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

    split(Arrays.asList("x"), "x", '|', false, false);
    split(Arrays.asList(null,"x"), "|x", '|', false, false);
   
    Record record = new Record();
    CSVTokenizer tokenizer = new SimpleCSVTokenizer(',', true, true, new ArrayList<String>());
    tokenizer.tokenizeLine(" x ", null, record);
    assertEquals(Arrays.asList("x"), record.get("column0"));
  }
 
  private void split(List expected, String line, char separator, boolean isQuoted, boolean addEmptyStrings) throws IOException {
    Record record = new Record();
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

  private void split(List expected, String line, char separator, boolean isQuoted, boolean addEmptyStrings) throws IOException {
    Record record = new Record();
    CSVTokenizer tokenizer;
    if (isQuoted) {
      tokenizer = new QuotedCSVTokenizer(separator, false, addEmptyStrings, new ArrayList<String>(), 1000, false, '"');
      tokenizer.tokenizeLine(line, new BufferedReader(new StringReader("")), record);     
    } else {
      tokenizer = new SimpleCSVTokenizer(separator, false, addEmptyStrings, new ArrayList<String>());
      tokenizer.tokenizeLine(line, null, record);
    }
    for (int i = 0; i < expected.size(); i++) {
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

    if (isQuoted) {
      tokenizer = new QuotedCSVTokenizer(separator, false, addEmptyStrings, new ArrayList<String>(), 1000, false, '"');
      tokenizer.tokenizeLine(line, new BufferedReader(new StringReader("")), record);     
    } else {
      tokenizer = new SimpleCSVTokenizer(separator, false, addEmptyStrings, new ArrayList<String>());
      tokenizer.tokenizeLine(line, null, record);
    }
    for (int i = 0; i < expected.size(); i++) {
      assertEquals(expected.get(i), record.getFirstValue("column" + i));
    }
    assertTrue(record.getFields().asMap().size() <= expected.size());
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

  public void testThrowExceptionIfRecordTooLong() throws Exception {
    boolean ignoreTooLongRecords = false;
    int maxCharactersPerRecord = 10;
    CSVTokenizer tokenizer = new QuotedCSVTokenizer(
        ',', false, false, new ArrayList<String>(), maxCharactersPerRecord, ignoreTooLongRecords, '"');
    tokenizer.tokenizeLine(
        "\"",
        new BufferedReader(new StringReader("line tooooooooo long\"")),
        new Record());
  }
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.CSVTokenizer.tokenizeLine()

  public void testIgnoreRecordTooLong() throws Exception {
    boolean ignoreTooLongRecords = true;
    int maxCharactersPerRecord = 10;
    CSVTokenizer tokenizer = new QuotedCSVTokenizer(
        ',', false, false, new ArrayList<String>(), maxCharactersPerRecord, ignoreTooLongRecords, '"');
    assertFalse(tokenizer.tokenizeLine(
        "\"",
        new BufferedReader(new StringReader("line tooooooooo long\"")),
        new Record()));
  }
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.QuotedCSVTokenizer.tokenizeLine()

  public void testThrowExceptionIfRecordTooLong() throws Exception {
    boolean ignoreTooLongRecords = false;
    int maxCharactersPerRecord = 10;
    CSVTokenizer tokenizer = new QuotedCSVTokenizer(
        ',', false, false, new ArrayList<String>(), maxCharactersPerRecord, ignoreTooLongRecords, '"');
    tokenizer.tokenizeLine(
        "\"",
        new BufferedReader(new StringReader("line tooooooooo long\"")),
        new Record());
  }
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.QuotedCSVTokenizer.tokenizeLine()

  public void testIgnoreRecordTooLong() throws Exception {
    boolean ignoreTooLongRecords = true;
    int maxCharactersPerRecord = 10;
    CSVTokenizer tokenizer = new QuotedCSVTokenizer(
        ',', false, false, new ArrayList<String>(), maxCharactersPerRecord, ignoreTooLongRecords, '"');
    assertFalse(tokenizer.tokenizeLine(
        "\"",
        new BufferedReader(new StringReader("line tooooooooo long\"")),
        new Record()));
  }
View Full Code Here

Examples of org.kitesdk.morphline.shaded.com.googlecode.jcsv.fastreader.SimpleCSVTokenizer.tokenizeLine()

    split(Arrays.asList("x"), "x", '|', false, false);
    split(Arrays.asList(null,"x"), "|x", '|', false, false);
   
    Record record = new Record();
    CSVTokenizer tokenizer = new SimpleCSVTokenizer(',', true, true, new ArrayList<String>());
    tokenizer.tokenizeLine(" x ", null, record);
    assertEquals(Arrays.asList("x"), record.get("column0"));
  }
 
  private void split(List expected, String line, char separator, boolean isQuoted, boolean addEmptyStrings) throws IOException {
    Record record = new Record();
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.