Codota Logo
CsvConfiguration.<init>
Code IndexAdd Codota to your IDE (free)

How to use
com.asakusafw.runtime.io.csv.CsvConfiguration
constructor

Best Java code snippets using com.asakusafw.runtime.io.csv.CsvConfiguration.<init> (Showing top 13 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: stackoverflow.com

public static Object[][] getCsvData( File csvFile ) 
 {   
   CsvConfiguration conf = new CsvConfiguration( 1 );
   DataContext csvContext = DataContextFactory.createCsvDataContext( csvFile, conf );
   Schema schema = csvContext.getDefaultSchema();
   Table[] tables = schema.getTables();
   Table table = tables[0]; // a representation of the csv file name including extension
   DataSet dataSet = csvContext.query()
       .from( table )
       .selectAll()
       .where("run").eq("Y")
       .execute();
   List<Row> rows = dataSet.toRows();
   Object[][] myArray = get2ArgArrayFromRows( rows );
   return myArray;
 }
origin: asakusafw/asakusafw

private CsvConfiguration createConfiguration() {
  CsvConfiguration conf = new CsvConfiguration(
      CsvConfiguration.DEFAULT_CHARSET,
      headers,
      trueFormat,
      falseFormat,
      dateFormat,
      dateTimeFormat);
  return conf;
}
origin: asakusafw/asakusafw-examples

/**
 * Returns this CSV format configuration.
 * @param head whether configure for head of file or not
 * @return CSV format configuration
 */
protected CsvConfiguration getConfiguration(boolean head) {
  List<String> headers = new ArrayList<>();
  if(head) {
    headers.add("店舗コード");
    headers.add("名称");
  }
  CsvConfiguration config = new CsvConfiguration(Charset.forName("UTF-8"), headers, "true", "false", "yyyy-MM-dd", 
      "yyyy-MM-dd HH:mm:ss");
  config.setLineBreakInValue(false);
  return config;
}
@Override
origin: asakusafw/asakusafw-examples

/**
 * Returns this CSV format configuration.
 * @param head whether configure for head of file or not
 * @return CSV format configuration
 */
protected CsvConfiguration getConfiguration(boolean head) {
  List<String> headers = new ArrayList<>();
  if(head) {
    headers.add("カテゴリコード");
    headers.add("販売数量");
    headers.add("売上合計");
  }
  CsvConfiguration config = new CsvConfiguration(Charset.forName("UTF-8"), headers, "true", "false", "yyyy-MM-dd", 
      "yyyy-MM-dd HH:mm:ss");
  config.setLineBreakInValue(false);
  return config;
}
@Override
origin: asakusafw/asakusafw-examples

/**
 * Returns this CSV format configuration.
 * @param head whether configure for head of file or not
 * @return CSV format configuration
 */
protected CsvConfiguration getConfiguration(boolean head) {
  List<String> headers = new ArrayList<>();
  if(head) {
    headers.add("ファイル名");
    headers.add("日時");
    headers.add("店舗コード");
    headers.add("商品コード");
    headers.add("メッセージ");
  }
  CsvConfiguration config = new CsvConfiguration(Charset.forName("UTF-8"), headers, "true", "false", "yyyy-MM-dd", 
      "yyyy-MM-dd HH:mm:ss");
  config.setLineBreakInValue(false);
  return config;
}
@Override
origin: asakusafw/asakusafw-examples

/**
 * Returns this CSV format configuration.
 * @param head whether configure for head of file or not
 * @return CSV format configuration
 */
protected CsvConfiguration getConfiguration(boolean head) {
  List<String> headers = new ArrayList<>();
  if(head) {
    headers.add("日時");
    headers.add("店舗コード");
    headers.add("商品コード");
    headers.add("数量");
    headers.add("販売単価");
    headers.add("販売金額");
  }
  CsvConfiguration config = new CsvConfiguration(Charset.forName("UTF-8"), headers, "true", "false", "yyyy-MM-dd", 
      "yyyy-MM-dd HH:mm:ss");
  config.setLineBreakInValue(false);
  return config;
}
@Override
origin: asakusafw/asakusafw-examples

/**
 * Returns this CSV format configuration.
 * @param head whether configure for head of file or not
 * @return CSV format configuration
 */
protected CsvConfiguration getConfiguration(boolean head) {
  List<String> headers = new ArrayList<>();
  if(head) {
    headers.add("商品コード");
    headers.add("商品名");
    headers.add("部門コード");
    headers.add("部門名");
    headers.add("カテゴリコード");
    headers.add("カテゴリ名");
    headers.add("単価");
    headers.add("登録日");
    headers.add("適用開始日");
    headers.add("適用終了日");
  }
  CsvConfiguration config = new CsvConfiguration(Charset.forName("UTF-8"), headers, "true", "false", "yyyy-MM-dd", 
      "yyyy-MM-dd HH:mm:ss");
  config.setLineBreakInValue(false);
  return config;
}
@Override
origin: stackoverflow.com

public static Object[][] getCsvData(File csvFile) {
   CsvConfiguration conf = new CsvConfiguration(1);
   DataContext csvContext = DataContextFactory.createCsvDataContext(
       csvFile, conf);
   Schema schema = csvContext.getDefaultSchema();
   Table[] tables = schema.getTables();
   Table table = tables[0];
   DataSet dataSet = csvContext.query().from(table).selectAll().where("run").eq("Y").execute();
   List<Row> rows = dataSet.toRows();
   Object[][] myArray = new Object[rows.size()][2];
   int i = 0;
   SelectItem[] cols = rows.get(0).getSelectItems();
   for (Row r : rows) {
     Object[] data = r.getValues();
     for (int j = 0; j < cols.length; j++) {
       if (data[j] == null)
         data[j] = ""; // force empty string where there are NULL
                 // values
     }
     myArray[i][0] = cols;
     myArray[i][1] = data;
     i++;
   }
   logger.info("Row count: " + rows.size());
   logger.info("Column names: " + Arrays.toString(cols));
   return myArray;
 }
origin: stackoverflow.com

private Serializer getSerializer() {
   CsvConfiguration config = new CsvConfiguration();
   config.setFieldDelimiter(';');
   config.setDefaultQuoteMode(QuoteMode.NEVER); //!!!!
   return CsvIOFactory.createFactory(config, MyCsvDto.class).createSerializer();
 }
origin: asakusafw/asakusafw

private CsvConfiguration createConfiguration() {
  CsvConfiguration conf = new CsvConfiguration(
      CsvConfiguration.DEFAULT_CHARSET,
      headers,
      trueFormat,
      falseFormat,
      dateFormat,
      dateTimeFormat);
  conf.setForceQuoteColumns(quote.stream().mapToInt(i -> i).toArray());
  return conf;
}
origin: stackoverflow.com

CsvConfiguration conf = new CsvConfiguration( 1 );
DataContext csvContext = DataContextFactory.createCsvDataContext( csvFile, conf );
Schema schema = csvContext.getDefaultSchema();
origin: stackoverflow.com

CsvConfiguration config = new CsvConfiguration();
config.setFieldDelimiter(',');
return config;
origin: asakusafw/asakusafw

private String[][] parse(int columns, String string) {
  CsvConfiguration conf = new CsvConfiguration(
      CsvConfiguration.DEFAULT_CHARSET,
      CsvConfiguration.DEFAULT_HEADER_CELLS,
      CsvConfiguration.DEFAULT_TRUE_FORMAT,
      CsvConfiguration.DEFAULT_FALSE_FORMAT,
      CsvConfiguration.DEFAULT_DATE_FORMAT,
      CsvConfiguration.DEFAULT_DATE_TIME_FORMAT);
  List<String[]> results = new ArrayList<>();
  ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes(conf.getCharset()));
  try (CsvParser parser = new CsvParser(input, string, conf)) {
    StringOption buffer = new StringOption();
    while (parser.next()) {
      String[] line = new String[columns];
      for (int i = 0; i < columns; i++) {
        parser.fill(buffer);
        line[i] = buffer.or((String) null);
      }
      parser.endRecord();
      results.add(line);
    }
  } catch (Exception e) {
    throw new AssertionError(e);
  }
  return results.toArray(new String[results.size()][]);
}
com.asakusafw.runtime.io.csvCsvConfiguration<init>

Javadoc

Creates a new instance.

Popular methods of CsvConfiguration

  • getCharset
    Returns the character set encoding name.
  • getDateFormat
    The Date format in SimpleDateFormat.
  • getDateTimeFormat
    The DateTime format in SimpleDateFormat.
  • getFalseFormat
    The boolean false format.
  • getForceQuoteColumns
    Returns column indices which quoting is always required.
  • getHeaderCells
    The header cell values.
  • getSeparatorChar
    Returns the field separator character.
  • getTrueFormat
    The boolean true format.
  • isForceConsumeHeader
    Returns whether forcibly consumes header cells or not.
  • isLineBreakInValue
    Returns whether allows line breaks in value.
  • setDefaultQuoteMode
  • setFieldDelimiter
  • setDefaultQuoteMode,
  • setFieldDelimiter,
  • setForceQuoteColumns,
  • setLineBreakInValue

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • Path (java.nio.file)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now