Tabnine Logo
org.supercsv.io
Code IndexAdd Tabnine to your IDE (free)

How to use org.supercsv.io

Best Java code snippets using org.supercsv.io (Showing top 20 results out of 315)

origin: apache/hive

/**
 * Fills the class's internal buffer with a DSV line
 */
private void fillBuffer(CsvListWriter writer, Rows.Row row) {
 String[] vals = row.values;
 try {
  writer.write(vals);
  writer.flush();
 } catch (Exception e) {
  beeLine.error(e);
 }
}
origin: apache/nifi

@Override
public List<Object> read(CellProcessor... processors) throws IOException {
  if( processors == null ) {
    throw new NullPointerException("Processors should not be null");
  }
  if( readRow() ) {
    super.executeProcessors(new ArrayList<Object>(getColumns().size()), processors);
    return new ArrayList<Object>(getColumns());
  }
  return null; // EOF
}
origin: apache/kylin

csvWriter = new CsvListWriter(response.getWriter(), CsvPreference.STANDARD_PREFERENCE);
csvWriter.writeHeader(headerList.toArray(headers));
  csvWriter.write(row);
origin: apache/hive

@Override
public int print(Rows rows) {
 CsvPreference csvPreference = getCsvPreference();
 CsvListWriter writer = new CsvListWriter(this.buffer, csvPreference);
 int count = 0;
 Rows.Row labels = (Rows.Row) rows.next();
 if (beeLine.getOpts().getShowHeader()) {
  fillBuffer(writer, labels);
  String line = getLine(this.buffer);
  beeLine.output(line);
 }
 while (rows.hasNext()) {
  fillBuffer(writer, (Rows.Row) rows.next());
  String line = getLine(this.buffer);
  beeLine.output(line);
  count++;
 }
 return count;
}
origin: bill1012/AdminEAP

private static CsvPOJO readWithCsvMapReader(String file) throws Exception {
  CsvPOJO csvPojo = new CsvPOJO();
  Map<String, String> readMap = null;
  ICsvMapReader mapReader = null;
  try {
    mapReader = new CsvMapReader(new FileReader(file), CsvPreference.STANDARD_PREFERENCE);
    String[] headers = mapReader.getHeader(true);
    List<CsvRow> rows = new ArrayList<CsvRow>();
    while ((readMap = mapReader.read(headers)) != null) {
      CsvRow row = new CsvRow();
      List<String> columns = new ArrayList<String>();
      for (String h : headers) {
        if (!StrUtil.isEmpty(h)) {
          columns.add(readMap.get(h));
        }
      }
      row.setCols(columns);
      rows.add(row);
    }
    csvPojo.setHeaders(headers);
    csvPojo.setRows(rows);
  } finally {
    if (mapReader != null) {
      mapReader.close();
    }
  }
  return csvPojo;
}
origin: com.sqlapp/sqlapp-core

  @Override
  public ICsvListReader createCsvListReader(Reader reader){
    return new CsvListReader(reader, CsvPreference.EXCEL_PREFERENCE);
  }
}
origin: stackoverflow.com

 public class CSVReader extends DataReader<List<String>> {

  private final ICsvListReader reader; 

  ...

  @Override
  public List<String> readNext() throws IOException {
   return reader.read(); //read already throws an IOException so you're good to go
  }
}
origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public void writeHeader(final String... header) throws IOException {
  
  // update the current row/line numbers
  incrementRowAndLineNo();
  
  writeRow(header);
}

origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public void write(final Object source, final String... nameMapping) throws IOException {
  
  // update the current row/line numbers
  super.incrementRowAndLineNo();
  
  // extract the bean values
  extractBeanValues(source, nameMapping);
  
  // write the list
  super.writeRow(beanValues);
}

origin: org.paxml/paxml-core

@Override
public void flush() throws IOException {
  if (writer != null) {
    writer.flush();
  }
}
origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public int getLineNumber() {
  return tokenizer.getLineNumber();
}

origin: net.sf.supercsv/super-csv

/**
 * Closes the Tokenizer and its associated Reader.
 */
public void close() throws IOException {
  tokenizer.close();
}

origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public String getUntokenizedRow() {
  return tokenizer.getUntokenizedRow();
}

origin: com.sqlapp/sqlapp-core

@Override
public ICsvListWriter createCsvListWriter(Writer writer){
  return new CsvListWriter(writer, CsvPreference.EXCEL_PREFERENCE);
}
@Override
origin: com.sqlapp/sqlapp-core

  @Override
  public ICsvListReader createCsvListReader(Reader reader){
    return new CsvListReader(reader, CsvPreference.TAB_PREFERENCE);
  }
}
origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public void write(List<?> columns) throws IOException {
  super.incrementRowAndLineNo();
  super.writeRow(columns);
}

origin: com.sqlapp/sqlapp-core

@Override
public ICsvListWriter createCsvListWriter(Writer writer){
  return new CsvListWriter(writer, CsvPreference.EXCEL_NORTH_EUROPE_PREFERENCE);
}
@Override
origin: net.sf.supercsv/super-csv

/**
 * {@inheritDoc}
 */
public void write(final Object... columns) throws IOException {
  super.incrementRowAndLineNo();
  super.writeRow(columns);
}

origin: com.sqlapp/sqlapp-core

@Override
public ICsvListWriter createCsvListWriter(Writer writer){
  return new CsvListWriter(writer, CsvPreference.TAB_PREFERENCE);
}
@Override
origin: net.sf.supercsv/super-csv

  /**
   * {@inheritDoc}
   */
  public void write(final String... columns) throws IOException {
    super.incrementRowAndLineNo();
    super.writeRow(columns);
  }
}
org.supercsv.io

Most used classes

  • CsvListWriter
    CsvListWriter is a simple writer capable of writing arrays and Lists to a CSV file.
  • CsvListReader
    CsvListReader is a simple reader that reads a row from a CSV file into a List of Strings.
  • CsvMapReader
    CsvMapReader reads each CSV row into a Map with the column name as the map key, and the column value
  • CsvBeanWriter
    CsvBeanWriter writes a CSV file by mapping each field on the bean to a column in the CSV file (using
  • ICsvListReader
    Interface for readers that read into Lists.
  • CsvBeanReader,
  • CsvMapWriter,
  • ICsvBeanWriter,
  • ICsvBeanReader,
  • ICsvMapWriter,
  • ICsvListWriter,
  • AbstractCsvWriter,
  • CsvResultSetWriter,
  • AbstractCsvReader,
  • ICsvReader,
  • ITokenizer,
  • Tokenizer$TokenizerState,
  • Tokenizer,
  • CsvDozerBeanData
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now