Examples of CSVStrategy


Examples of org.apache.commons.csv.CSVStrategy

        String encStr = params.getFieldParam(fname,ENCAPSULATOR);
        char fenc = encStr==null || encStr.length()==0 ? (char)-2 : encStr.charAt(0);
        String escStr = params.getFieldParam(fname,ESCAPE);
        char fesc = escStr==null || encStr.length()==0 ? CSVStrategy.ESCAPE_DISABLED : escStr.charAt(0);

        CSVStrategy fstrat = new CSVStrategy(fsep,fenc,CSVStrategy.COMMENTS_DISABLED,fesc, false, false, false, false);
        adders[i] = new CSVLoader.FieldSplitter(fstrat, adders[i]);
      }
    }
  }
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

    char delimiter = CharUtils.toChar(loader.getDelimiter());
    char encapsulator = (loader.getEncapsulator() == null || loader
        .getEncapsulator().length() == 0) ? CSVStrategy.ENCAPSULATOR_DISABLED
        : CharUtils.toChar(loader.getEncapsulator());
    log.info(String.format("delimiter %d encapsulator %d", (int)delimiter, (int)encapsulator));
    CSVStrategy strategy = new CSVStrategy(delimiter, encapsulator, CSVStrategy.COMMENTS_DISABLED,
        CSVStrategy.ESCAPE_DISABLED, true, true, false, true);
    parser = new CSVParser(reader, strategy);
    this.loader = loader;
    formatMap = new HashMap<String, Format>();
    try {
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                CsvDataFormat csv = new CsvDataFormat();
                CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
                strategy.setDelimiter('|');
                csv.setStrategy(strategy);
               
                // also possible
                // CsvDataFormat csv = new CsvDataFormat();
                // csv.setDelimiter("|");
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                CsvDataFormat csv = new CsvDataFormat();
                CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
                strategy.setDelimiter('|');
                csv.setStrategy(strategy);
               
                // also possible
                // CsvDataFormat csv = new CsvDataFormat();
                // csv.setDelimiter("|");
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

  /**
   * This method replaces the current CSV strategy object with a new object.
   */ 
  public void ConfigureCSV(){
    this.csvstrat = new CSVStrategy(this.getCSVSeparator(),this.getCSVEncapsulator(),this.getCSVComment(),this.isIgnoreLeadingSpaces(),this.isInterpretUnicodeEscapes(),this.isIgnoreEmptyLines());
  }
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

        return null;
    }

    public void exportTo(File file) throws IOException
    {
        CSVStrategy strategy = new CSVStrategy(';', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED,
                        false, false, false, false);

        Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")); //$NON-NLS-1$

        try
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

        try
        {
            stream = new FileInputStream(inputFile);
            Reader reader = new InputStreamReader(stream, encoding);

            CSVStrategy strategy = new CSVStrategy(delimiter, '"', CSVStrategy.COMMENTS_DISABLED,
                            CSVStrategy.ESCAPE_DISABLED, false, false, false, false);

            CSVParser parser = new CSVParser(reader, strategy);

            for (int ii = 0; ii < skipLines; ii++)
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                CsvDataFormat csv = new CsvDataFormat();
                CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
                strategy.setDelimiter('|');
                csv.setStrategy(strategy);
               
                // also possible
                // CsvDataFormat csv = new CsvDataFormat();
                // csv.setDelimiter("|");
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

      templateAdd.allowDups=true;
      templateAdd.overwriteCommitted=false;
      templateAdd.overwritePending=false;
    }

    strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, true,  false, true);
    String sep = params.get(SEPARATOR);
    if (sep!=null) {
      if (sep.length()!=1) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid separator:'"+sep+"'");
      strategy.setDelimiter(sep.charAt(0));
    }
View Full Code Here

Examples of org.apache.commons.csv.CSVStrategy

        String sepStr = params.getFieldParam(fname,SEPARATOR);
        char fsep = sepStr==null || sepStr.length()==0 ? ',' : sepStr.charAt(0);
        String encStr = params.getFieldParam(fname,ENCAPSULATOR);
        char fenc = encStr==null || encStr.length()==0 ? '\'' : encStr.charAt(0);

        CSVStrategy fstrat = new CSVStrategy(fsep,fenc,CSVStrategy.COMMENTS_DISABLED);
        adders[i] = new CSVLoader.FieldSplitter(fstrat, adders[i]);
      }
    }
  }
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.