Examples of CSVParser

There is one exception to the commonly-accepted parsing rules: Embedded line breaks in a quoted field are not parsed but instead interpreted as the premature end of a record. This was a deliberate decision given the scope of this parser and the fact that it parses only a single line of input. @author Johannes Rössel
  • weave.utils.CSVParser
    Parses and generates CSV-encoded tables. Also supports custom delimiters and quotes. @author adufilie

  • Examples of org.beangle.commons.csv.internal.CsvParser

        this(reader, new CsvFormat.Builder().build());
      }

      public CsvReader(Reader reader, CsvFormat format) {
        this.br = new BufferedReader(reader);
        this.parser = new CsvParser(format);
        this.skipLines = 0;
      }
    View Full Code Here

    Examples of org.beangle.util.csv.internal.CsvParser

        this(reader, new CsvFormat.Builder().build());
      }

      public CsvReader(Reader reader, CsvFormat format) {
        this.br = new BufferedReader(reader);
        this.parser = new CsvParser(format);
        this.skipLines = 0;
      }
    View Full Code Here

    Examples of org.dbcooper.io.CsvParser

      private ITable getCsvTable() {
        return new CsvTable("table1", new ClassPathResource("CsvTableTest.csv", getClass()));
      }

      private ITable getCustomCsvTable() {
        return new CsvTable(new CsvParser("\"'", '|'), "table1", new ClassPathResource("CsvTableTest.txt", getClass()));
      }
    View Full Code Here

    Examples of org.dbunit.dataset.csv.CsvParser

        @Override
        protected IDataSet loadDataSet(final File source) throws DataSetException,
                IOException {
            final CachedDataSet dataSet = new CachedDataSet();
            dataSet.startDataSet();
            final CsvParser parser = new CsvParserImpl();
            final List readData = parser.parse(source);
            final List readColumns = ((List) readData.get(0));
            final Column[] columns = new Column[readColumns.size()];
            for (int i = 0; i < readColumns.size(); i++) {
                columns[i] = new Column((String) readColumns.get(i),
                        DataType.UNKNOWN);
    View Full Code Here

    Examples of org.drools.decisiontable.parser.csv.CsvParser

        InputType
    {

        public DecisionTableParser createParser(SheetListener listener)
        {
            return new CsvParser( listener,
                                  new CsvLineParser( ) );
        }
    View Full Code Here

    Examples of org.drools.decisiontable.parser.csv.CsvParser

    }

    class CsvInput extends InputType {

        public DecisionTableParser createParser(final SheetListener listener) {
            return new CsvParser( listener,
                                  new CsvLineParser() );
        }
    View Full Code Here

    Examples of org.drools.decisiontable.parser.csv.CsvParser

            return new CsvParser( listener,
                                  new CsvLineParser() );
        }

        public DecisionTableParser createParser(final List listeners) {
          return new CsvParser( listeners,
              new CsvLineParser() );
        }
    View Full Code Here

    Examples of org.fastlsh.parsers.CSVParser

            IndexOptions options = new IndexOptions();
            options.numHashes = Integer.parseInt(cmd.getOptionValue("n"));
            options.vectorDimension = Integer.parseInt(cmd.getOptionValue("d"));
            options.hashFamily = HashFamily.getCosineHashFamily(options.vectorDimension, options.numHashes);
            options.numPermutations = Integer.parseInt(cmd.getOptionValue("np"));
            VectorParser<String> parser = new CSVParser(cmd.getOptionValue("sep"));
           
            BufferedReader reader = null;
            RandomProjectionSignatureIndexWriter<String> indexer = null;
            int numLines = 0;
            long start = System.currentTimeMillis();
    View Full Code Here

    Examples of org.jamesii.core.data.runtime.CSVParser

      private CSVParser parser;

      @Override
      protected void setUp() throws Exception {
        this.parser = new CSVParser();
      }
    View Full Code Here

    Examples of weave.utils.CSVParser

      public void checkKeyColumnsForCSVImport(String csvFile, String[] keyColumns) throws RemoteException
      {
        if (keyColumns.length == 0)
          throw new RemoteException("No key columns specified");
       
        final CSVParser csvParser = CSVParser.defaultParser;

        String[][] rows;
        try
        {
          rows = csvParser.parseCSV(new File(getUploadPath(), csvFile), true);
        }
        catch (IOException cause)
        {
          if (cause instanceof RemoteException)
            throw (RemoteException)cause;
          throw new RemoteException(String.format("Unable to read file \"%s\"", csvFile), cause);
        }
        if (rows.length == 0)
          throw new RemoteException(String.format("File is empty: %s", csvFile));
       
        String[] headers = rows[0];
       
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        int[] keyColumnIndices = new int[keyColumns.length];
         
        for (int i = 0; i < keyColumns.length;i++)
        {
          keyColumnIndices[i] = ListUtils.findString(keyColumns[i], headers);
          if (keyColumnIndices[i] < 0)
            throw new RemoteException(String.format("CSV file \"%s\" does not have a column named \"%s\"", csvFile, keyColumns[i]));
        }
       
        for (int row = 1; row < rows.length; row++)
        {
          String[] keyArray = ListUtils.getItems(rows[row], keyColumnIndices);
          String key = csvParser.createCSVRow(keyArray, true);
          if (!map.containsKey(key))
          {
            map.put(key, row);
          }
          else
          {
            // ignore blank rows
            boolean allEmpty = true;
            for (String value : rows[row])
            {
              if (!Strings.isEmpty(value))
              {
                allEmpty = false;
                break;
              }
            }
            if (allEmpty)
              continue;
           
            int prevRow = map.get(key);
            String msg = String.format(
                "Found duplicate key (%s) on rows %s and %s of \"%s\"\n" +
                "Row %s: %s\n" +
                "Row %s: %s",
                key, prevRow, row, csvFile,
                prevRow, csvParser.createCSVRow(rows[prevRow], true),
                row, csvParser.createCSVRow(rows[row], true)
              );
            throw new RemoteException(msg);
          }
        }
      }
    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.