Examples of CSVReader


Examples of Readers.CSVReader

        dataFilePath = dataFilePath.toLowerCase();
        FileReader fileReader=null;
        if(dataFilePath.endsWith("csv")){
            BufferedReader in=null;
            in = new BufferedReader(new java.io.FileReader(dataFilePath));
            fileReader = new CSVReader(in);
        }
        if(dataFilePath.endsWith("xls")){
            fileReader = new XLSReader(new File(dataFilePath));
        }
        if(dataFilePath.endsWith("wss")){
View Full Code Here

Examples of ariba.util.io.CSVReader

       These Strings are trimed and converted into lower case.
    */
    private static String[] readFileToStrings (URL url)
    {
        ContentCollector collector = new ContentCollector();
        CSVReader reader = new CSVReader(collector);
        try {
            reader.read(url, "8859_1");
        }
        catch (IOException ioe) {
            Log.aribaweb.warn(Fmt.S("Failed to read from %s", url));
            return null;
        }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

public class CsvLineData extends AbstractLineData {
    private final CSVReader csvReader;

    public CsvLineData(Reader reader, char delim, int offset) {
        super(offset);
        this.csvReader = new CSVReader(reader, delim,'"','\\',0,false,false);
        initHeaders(createHeaders(readRawRow()));
        createMapData(lineSize, offset);
    }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

public class OpenCSVTest {

    @Test
    public void testReadLineWithCommaSeparator() throws Exception {
        final StringReader headerWithLine = new StringReader("a,b\n1,42");
        assertReadFile(new CSVReader(headerWithLine), "42");
    }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

        assertReadFile(new CSVReader(headerWithLine), "42");
    }
    @Test
    public void testReadLineWithTabSeparator() throws Exception {
        final StringReader headerWithLine = new StringReader("a\tb\n1\t42");
        assertReadFile(new CSVReader(headerWithLine,'\t'), "42");
    }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

        assertReadFile(new CSVReader(headerWithLine,'\t'), "42");
    }
    @Test
    public void testReadLineWithTabSeparatorAndDoubleQuotes() throws Exception {
        final StringReader headerWithLine = new StringReader("a\t\"b\"\n1\t\"42\"");
        assertReadFile(new CSVReader(headerWithLine,'\t','"'), "42");
    }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

    }

    @Test
    public void testReadLineWithTabSeparatorAndDoubleQuotesWithNewlineInValue() throws Exception {
        final StringReader headerWithLine = new StringReader("a\t\"b\"\n1\t\"4\n2\"");
        assertReadFile(new CSVReader(headerWithLine,'\t','"'), "4\n2");
    }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

    }

    @Test
    public void testReadLineWithCommaSeparator() throws Exception {
        final BufferedReader reader = new BufferedReader(new FileReader(TEST_CSV));
        final CSVReader csvReader = new CSVReader(reader,'\t','"');

        int res = 0;
        long time = System.currentTimeMillis();
        String[] line = null;
        while ((line = csvReader.readNext()) != null) {
            res += line.length;
        }
        time = System.currentTimeMillis() - time;
        System.out.println("time = " + time + " ms.");
        Assert.assertEquals(ROWS * COLS, res);
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

    }
  }

  private static void parseResults(InputStream in, SearchResultListener srl)
    throws IOException {
    CSVReader csvr = new CSVReader(new InputStreamReader(in));
    try {
      String [] header = csvr.readNext();

      if (header != null
          && header.length > 0
          && !(header.length == 1 && header[0].isEmpty())) {
        srl.setFieldNames(header);

        String[] line;
        while ((line = csvr.readNext()) != null) {
          if (line.length == header.length) {
            srl.processSearchResult(line);
          }
        }
      }
View Full Code Here

Examples of au.com.bytecode.opencsv.CSVReader

     * </ul>
     */
    private int source;

    public SplunkResultEnumerator(InputStream in, List<String> wantedFields) {
      csvReader = new CSVReader(new InputStreamReader(in));
      try {
        fieldNames = csvReader.readNext();
        if (fieldNames == null
            || fieldNames.length == 0
            || fieldNames.length == 1 && fieldNames[0].isEmpty()) {
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.